This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFH] Folding of &a[-1]
- From: Paul Schlie <schlie at comcast dot net>
- To: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Wed, 16 Feb 2005 08:00:13 -0500
- Subject: Re: [RFH] Folding of &a[-1]
> Richard Guenther wrote:
> While trying to implement folding of &a +- cst to &a[c] I came
> along the C frontend, which for
>
> int a[4];
> int *p = &a[-1];
>
> produces
>
> p = &a + (int *)-4;
Would guess it should be:
p = &a - (int *)4;
or even:
p = &a + - (int *)4;
Either yielding:
&a[-4U/4U] from &a[-1]
Which would seem consistent.
(maybe in general negative unsigned values should be represented as a
unary minus expression with an unsigned argument: (MINUS (CONST unsigned))
-paul-