------- Comment #7 from rguenth at gcc dot gnu dot org 2005-11-14 16:27 ------- Valid testcase (?):
void abort(void); int main() { int a[10], *p, *q; q = &a[1]; p = &q[-1]; if (p >= &a[9]) abort (); return 0; } fold_stmt is doing the &a[0] + -4B to &a[1073741823] transformation. But it somehow looks the C representation of &a[X] with pointer addition is not a good idea. The C++ frontend makes out of the above int main() () { int a[10]; <bb 0>: if (&a[9] <= &a[1073741824]) goto <L0>; else goto <L1>; <L0>:; abort (); <L1>:; return 0; } I'm unsure how to fix this without completely disabling the comparison folding for anything but == and !=. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24851