[Bug rtl-optimization/86990] New: wrong code at -O2 on x86_64-linux-gnu in 64-bit mode
su at cs dot ucdavis.edu
gcc-bugzilla@gcc.gnu.org
Fri Aug 17 07:56:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86990
Bug ID: 86990
Summary: wrong code at -O2 on x86_64-linux-gnu in 64-bit mode
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: su at cs dot ucdavis.edu
Target Milestone: ---
It appears to be a recent regression. The reduced version is still quite large
and complex, but it should be valid. The original unreduced test is
miscompiled at -O2 and -O3 in both 32-bit and 64-bit modes.
$ 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 20180817 (experimental) [trunk revision 263611] (GCC)
$
$ gcctk -Os -w small.c; ./a.out
5
$ gcc-8.1.0 -O2 -w small.c; ./a.out
5
$
$ gcctk -O2 -w small.c; ./a.out
7
$
---------------------------------------
int printf (const char *, ...);
int i[6];
static int j, v, e, f, h = 5, k, l, n, o, p, q, r, s, u, w, x, y, z, aa, ab,
ac,
ad, ae, af, ag = 8, ah, ai, aj, ak, al;
char c;
struct a {
unsigned b;
int c : 9;
int d;
} static g = {9, 5};
static short m[1], t = 95, am;
int an, ao, ap;
void aq(ar) {
j = j & 5 ^ i[j ^ v & 5];
j = j & 5 ^ i[(j ^ v) & 5];
j = j & 4095 ^ (j ^ v) & 5;
}
void as(ar) {
if (n)
s = 0;
}
static unsigned at() {
int au[] = {4073709551615, 0};
for (; al; al--) {
if (r)
--x;
if (g.d)
l++;
printf("", j);
if (u)
ae = n = au[al];
}
r = 0;
return 0;
}
int aw(ar) {
int ax[] = {9, 5, 5, 9, 5}, ay = 3;
struct a az = {1, 3};
av:
an = (as((at(), ax)[2]), ax[4]);
{
int ba[] = {5, 5, 9, 8, 1, 0, 5, 5, 9, 8, 1, 0,
5, 5, 9, 8, 1, 0, 5, 5, 9, 8, 1};
int a[] = {8, 2, 8, 2, 8, 2, 8};
int b[] = {1027239, 8, 1, 7, 9, 2, 9, 4, 4, 2, 8, 1, 0, 4, 4, 2,
4, 4, 2, 9, 2, 9, 8, 1, 7, 9, 2, 9, 4, 4, 2};
if (z) {
struct a bc;
bb:
for (; e; e++)
for (; q;)
return ax[e];
if (bc.c < g.d <= a[7])
aa--;
}
{
struct a bd = {5};
int d[20] = {1, 9, 7, 7, 8, 4, 4, 4, 4, 8, 1, 9, 7, 7, 8, 4, 4, 4, 4};
c = h | r % g.c ^ x;
printf("", g);
am -= t | x;
if (h)
while (1) {
if (a[o]) {
struct a be;
if (ar) {
struct a bf = {908, 5, 3};
int bg[3], bh = k, bj = ag | ae, bk = aj + 3, bl = u << e;
if (f)
if (ac)
ak = w;
ag = -(ag & t);
af = ag ^ af;
if (8 < af)
break;
if (bj)
goto bi;
if (s)
printf("", 6);
be.d = k;
w = f - bh;
printf("", be);
if (w)
goto bb;
ao = r - aa && g.b;
if (y)
k++;
goto av;
bi:
if (aa)
continue;
if (f)
if (k)
printf("", g);
aj = ac + k ^ g.c;
g.c = bk;
ah = 0;
for (; ah < 3; ah++)
if (s)
bg[ah] = 8;
if (!ay)
printf("", ai);
u = bl;
g = bf;
} else
for (;; o += a[ap])
;
int bm[] = {0};
for (; p; p++)
c = ad;
ad = l;
if (bd.c) {
printf(" ");
goto bi;
}
}
int bn[] = {5, 2, 2, 5, 2, 2, 5, 2, 2, 5, 2, 2, 5, 2, 2, 5,
2, 2, 5, 2, 2, 5, 2, 2, 5, 2, 2, 5, 2, 2, 5, 2,
2, 5, 2, 2, 5, 2, 2, 5, 2, 2, 5, 2, 2, 5, 2};
struct a a[] = {905266581905224, 2, 8, 4, 2, 8, 4, 4, 2, 8, 4};
struct a b = {3075920};
if (f) {
aq(m[am + e]);
printf("", j);
printf("", e);
ab--;
}
if (ax[4]) {
if (l)
goto av;
++f;
} else
ay = az.c && a;
for (; ac; ac++)
m[f] = 0;
}
h = 9;
for (; y; y = 1)
if (f)
goto av;
}
}
return 0;
}
int main() {
aw(1);
printf("%d\n", g.c);
return 0;
}
More information about the Gcc-bugs
mailing list