This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: patch: Sign-extension bug (?) in immed_double_const

Jeffrey A Law wrote:-

> This can't be correct.
> Consider :
> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]