This is the mail archive of the
mailing list for the GCC project.
Re: patch: Sign-extension bug (?) in immed_double_const
- To: Jeffrey A Law <law at cygnus dot com>
- Subject: Re: patch: Sign-extension bug (?) in immed_double_const
- From: Neil Booth <NeilB at earthling dot net>
- Date: Thu, 14 Sep 2000 18:30:37 +0100
- Cc: gcc-patches at gcc dot gnu dot org, Geoff Keating <geoffk at cygnus dot com>
- References: <20000830230940.A8409@daikokuya.demon.co.uk> <4484.968945213@upchuck>
Jeffrey A Law wrote:-
> This can't be correct.
> Consider :
> BITS_PER_WORD 32
> HOST_BITS_PER_WIDE_INT 32
> width 64
> i0 0x80180481
> i1 0
> Your change will turn that into
> i0 0xffffffff
> i1 0x0
> Which can't be correct.
> The "|| i1 == 0" clause seems totally bogus to me. I have no idea what you
> were trying to accomplish with that change, but it can't be right as written.
I agree it's not correct (it fails the stage2 compilation towards the
very end, on tmp-dum.c of all places). However, in the example you give
I think i0 and i1 remain unchanged.
I notice it can't be right for your example because it does too large
a left shift, which is undefined in ISO C.
The problem I have / had is finding documentation on the correct
representation of signed and unsigned constants in trees and rtx
types, and when extended to wider / narrower modes. The source of the
bug is the constant being treated as signed in once place but not in
another, and with various conversions going on it gets very confusing.