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 10:11:01 -0500
- Subject: Re: [RFH] Folding of &a[-1]
> Yes, of course, but it is the C frontent that is producing
> &a + (int *)-4, not me. I'm just trying to work around this...
>
> In fact, it is c-common.c:2289 that does -4 -> (int *)-4
> conversion, but pointer_int_sum is already called with PLUS_EXPR.
> build_unary_op unconditionally expands &x[y] to x+y, regardless
> of the sign of y. Of course the standard says that they are equal.
> But is &x[-1] == x + (int *)4*(int *)-1 ? From this follows that
> we have no way to convert this back to &x[-1], as we loose the
> sign information by the (int *) cast.
>
> How do the loop optimizers handle this - negative offsets by relying
> on unsigned pointer wrap-around?
- request the front-end be fixed?