This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: gcc const int expressions and negative constants
- To: Neil Booth <NeilB at earthling dot net>
- Subject: Re: gcc const int expressions and negative constants
- From: Geoff Keating <geoffk at cygnus dot com>
- Date: 16 Aug 2000 14:40:37 -0700
- CC: gcc-bugs at gcc dot gnu dot org
- References: <E13PABJ-0006Gp-00@daikokuya.demon.co.uk>
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>