This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH 0/2] Fix invalid left shift of negative value.
- From: <Paul_Koning at Dell dot com>
- To: <palves at redhat dot com>
- Cc: <kevinb at redhat dot com>, <gdb-patches at sourceware dot org>, <vogt at linux dot vnet dot ibm dot com>
- Date: Tue, 17 Nov 2015 17:33:37 +0000
- Subject: Re: [PATCH 0/2] Fix invalid left shift of negative value.
- Authentication-results: sourceware.org; auth=none
- References: <20151110154243 dot 43d38f49 at pinnacle dot lan> <20151111172327 dot 383F51407 at oc7340732750 dot ibm dot com> <20151111122708 dot 69c496d3 at pinnacle dot lan> <20151116220950 dot 1e0f4a89 at pinnacle dot lan> <564B3609 dot 6040008 at redhat dot com>
> On Nov 17, 2015, at 9:13 AM, Pedro Alves <firstname.lastname@example.org> wrote:
> On 11/17/2015 05:09 AM, Kevin Buettner wrote:
>> 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.
Agreed. One's complement is seriously obsolete. I can't think of any architecture in current use (in actual hardware) that uses it. You can of course easily find any number of examples supported in simulators like SIMH, but that isn't significant. None of those are likely to become GDB targets.
>> 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.
I remember reading a claim that C requires two's complement (at least ANSI C), so it's not likely that this will ever happen, and if it does, GDB will be the least of the port developer's worries.