https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78725
Bug ID: 78725
Summary: wrong code at -O3 on x86_64-linux-gnu (in both 32-bit
and 64-bit modes)
Product: gcc
Version: unknown
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: ---
$ 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 20161206 (experimental) [trunk revision 243299] (GCC)
$
$ gcc-trunk -O2 small.c; ./a.out
1
$ gcc-6.2 -O3 small.c; ./a.out
1
$
$ gcc-trunk -O3 small.c; ./a.out
0
$
----------------------------------------------
int printf (const char *, ...);
int fn1 (int b, int c)
{
return c < 0 || c > 31 ? 0 : b >> c;
}
unsigned char d = 255;
int e, f;
int main ()
{
for (; f < 2; f++)
e = fn1 (1, d++);
printf ("%d\n", e);
return 0;
}