https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77605
Bug ID: 77605
Summary: wrong code at -O3 on x86_64-linux-gnu
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: su at cs dot ucdavis.edu
Target Milestone: ---
This seems to affect at least all versions 4.6.x and later.
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160915 (experimental) [trunk revision 240161] (GCC)
$
$ gcc-trunk -O2 small.c; ./a.out
$
$ gcc-trunk -O3 small.c
$ ./a.out
Aborted (core dumped)
$
----------------------------------------
int a, b, c[2][8];
int main ()
{
for (a = 0; a < 8; a++)
for (b = 0; b < 2; b++)
c[b][a] = c[b][b + 6] ^ 1;
if (c[0][7] != 0)
__builtin_abort ();
return 0;
}