[Bug tree-optimization/61502] == comparison on "one-past" pointer gives wrong result
ch3root at openwall dot com
gcc-bugzilla@gcc.gnu.org
Mon Jun 27 19:14:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61502
--- Comment #19 from Alexander Cherepanov <ch3root at openwall dot com> ---
(In reply to joseph@codesourcery.com from comment #3)
> Except within a larger object, I'm not aware of any reason the cases of
> two objects following or not following each other in memory must be
> mutually exclusive.
Apparently some folks use linker scripts to get a specific arrangement of
objects.
A fresh example is a problem in Linux -- https://lkml.org/lkml/2016/6/25/77 . A
simplified example from http://pastebin.com/4Qc6pUAA :
extern int __start[];
extern int __end[];
extern void bar(int *);
void foo()
{
for (int *x = __start; x != __end; ++x)
bar(x);
}
This is optimized into an infinite loop by gcc 7 at -O.
More information about the Gcc-bugs
mailing list