[Bug tree-optimization/85529] New: wrong code at -O2 and -O3 on x86_64-linux-gnu
su at cs dot ucdavis.edu
gcc-bugzilla@gcc.gnu.org
Thu Apr 26 04:35:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85529
Bug ID: 85529
Summary: wrong code at -O2 and -O3 on x86_64-linux-gnu
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: ---
It appears to be a recent regression.
$ gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/home/su/software/tmp/gcc/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/home/su/software/tmp/gcc/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 9.0.0 20180426 (experimental) [trunk revision 259666] (GCC)
$
$ gcctk -Os small.c; ./a.out
1
$ gcc-7.3.0 -O2 small.c; ./a.out
1
$
$ gcctk -O2 small.c
$ ./a.out
0
$
--------------------------------------
int printf (const char *, ...);
struct S
{
int a;
};
int b, c = 1, d, e, f;
static int g;
volatile struct S s;
char h (char i, int j)
{
return i < 0 ? i : i << j;
}
int main ()
{
char k = -83;
if (!d)
goto L;
k = e || f;
L:
for (; b < 1; b++)
s.a != (k < h (k, 2) && (c = k = g));
printf ("%d\n", c);
return 0;
}
More information about the Gcc-bugs
mailing list