This is the mail archive of the gcc@gcc.gnu.org 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]
Other format: [Raw text]

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?



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