gcc const int expressions and negative constants
Geoff Keating
geoffk@cygnus.com
Wed Aug 16 14:40:00 GMT 2000
Neil Booth <NeilB@earthling.net> writes:
> What I'm confused about is whether the correct form of constants
> appearing in QImode expressions is (HOST_WIDE_INT) 255 or -1? The
It's -1.
> initial line
>
> unsigned char integer[2] = {255};
>
> produces a QImode store with constant -1. Combine makes that into a
> HImode store with constant 255. Then
This is right.
> sign = integer[0];
>
> produces another QImode store of -1,
This is also right.
> but then the mode is lost in the final comparison to 255.
Probably something is not truncating QImode -1 into SImode 255 when
converting between int and unsigned char in the expression
sign == 255
> This seems like a large can of worms. If someone can tell me what the
> intended correct method of using the constants is, I can try and fix
> it.
There are lots of bugs like these; we are tracking them down one by one.
--
- Geoffrey Keating <geoffk@cygnus.com>
More information about the Gcc-bugs
mailing list