Re: [PATCH 0/2] Fix invalid left shift of negative value.

Pedro Alves
2015-11-17T14:13:34Z

On 11/17/2015 05:09 AM, Kevin Buettner wrote:

> I came across this comment in defs.h:
>
> /* Defaults for system-wide constants (if not defined by xm.h, we fake it).
> FIXME: Assumes 2's complement arithmetic. */
>

(side note, the xm.h is gone since 2007..)

> Is this something that we really want to fix? Can anyone think of a
> host which can't run GDB (and upon which we'd like to run GDB) due the
> fact that it uses something other than the two's complement
> representation for signed integers?

Can't think of one.

> My opinion: Assumptions about two's complement in GDB should not be
> fixed. I can't think of any architecture that I'd care to use which
> uses something other than two's complement. My limited research on
> the matter shows that really archaic machines used one's complement or
> signed magnitude representations.
>
> If we all agree that this is something we don't want to fix, then I
> think we should remove that FIXME and assert somewhere that GDB is
> expected to be hosted on platforms which use two's complement
> representation for signed integers.

Agreed. If someone wants to port gdb to such a host, then we can
worry about it then.

Thanks,
Pedro Alves