[llvm-bugs] [Bug 32818] New: wrong code (compiled code hangs) at -O3 on x86_64-linux-gnu in 64-bit mode (but not in 32-bit)
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Apr 26 13:36:54 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=32818
Bug ID: 32818
Summary: wrong code (compiled code hangs) at -O3 on
x86_64-linux-gnu in 64-bit mode (but not in 32-bit)
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: su at cs.ucdavis.edu
CC: llvm-bugs at lists.llvm.org
It seems to be a very recent regression. The code has been extremely difficult
to reduce, so the included test case is still very hairy. But it should be
valid nonetheless.
$ clang -v
clang version 5.0.0 (trunk 301343)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang -m64 -O2 small.c; ./a.out
$ clang -m32 -O3 small.c; ./a.out
$
$ clang -m64 -O3 small.c
$ timeout -s 9 10 ./a.out
Killed
$
------------------------------------------------------------------------
int printf (const char *, ...);
char a, b, c, d, *e, a7, f, o, u, ba, au, av;
int g, i, j, k, l[6], m, n, p, v[] = { 1 }, x, z, aa, ab, an, aw, ax[] = { 64
}, ay, az, q, ac, ad;
short r, s, t, af = -1, ag = 1117, d7, d8, d6_0, ci;
char fn1 (char ah, char ai)
{
return ai ? ah % ai : ah;
}
void fn2 (int b)
{
m = m >> 8 ^ l[m ^ b];
}
static char fn3 ()
{
short w;
for (i = 0; i < 8; i++)
{
char ap = a7 % ac + d8;
unsigned aq = ~0x1F & u % (7 * ~ap ^ ad);
if ((aq < 1027) && z)
a7 = ((1958 | f) + 15) & 15;
}
for (; s; s++)
{
short as = 0;
for (; as < 3; as++)
for (d7 = 2; d7 >= 0; d7--)
if (an)
for (; an >= 0; an--)
u = x;
else
{
short at = an = as;
if (at <= j)
w = k ? r : k;
if (w)
return s;
}
}
return 0;
}
static char fn4 ()
{
int bd, bc, bf, j;
for (; t < 4; t++)
{
short bg = 0;
int bh, bi = 0, bj = 2;
while (aw)
{
int bl = 5 ^ ba;
char bm = bl * az;
if (bl)
az = aw < 3 * ~ba + bm;
int bo = ~af / printf ("%d%d%d\n", z, bo, 3);
printf ("%lld\n", (long long) 1958);
short bp = (~af % ~65531U & ~bi) | ba;
int bq = ~bp > aw + ~ac;
if (af)
bi = bq;
if (ba)
m = m >> 8 ^ l[m ^ 15];
if (n)
printf ("%s%d\n", e, m ^ 15);
printf ("%d%d%d\n", x, aa, z);
if (bi)
az = av ? b : c;
if (av)
au = q ? d : q;
int br = -aw | ~af | (5 & au), t15 = -ay % bi || af | ~ag / br,
bt = 1 % bi || a7;
short bs = ~az | 1 / ~au % 95 || a7;
if (bt && af)
t15 = ~a7 + au;
af = ~(0 < (bs ^ (t15 + 1)));
char bu = au | ac;
if (a7)
{
printf ("%llu\n", (long long) af);
ac = (ag ^ (31 / (a7 < az) < ba)) | ~1;
goto L;
}
ba = bu;
if (ag)
af = 3;
}
short bw = 0;
while (1)
{
if (ax[bi])
break;
for (bi = 0; bi < 4; bi++)
{
bf = (a ^ i) & i;
bd = bf ? bf : bf < g;
ax[af] = fn1 ((bg >= bd) | 160, j);
m = m >> 8 ^ l[m ^ (char) z];
fn2 (z > 6);
fn2 (v[ab + 2] & 15);
fn2 (v[aa * 2] > 6);
if (n)
printf ("%s%d\n", e, m ^ 0xFF);
if (j)
printf ("%d%d%d\n", ab, aa, 0);
}
}
for (; bi < 4; bi++)
{
short bx = (~bj ^ af % ~bi) | ~bw, by = a7 ^ -ag;
int bz = ~aw;
if (bz)
while (af > 3)
for (; bi; bi++)
{
m = m >> 8 ^ l[m ^ d6_0];
if (n)
printf ("%s%d\n", e, m ^ 0xFFF);
if (ab)
printf ("%d%d\n", bz, bi);
}
L:
a7 = a7 | (aw ^ (by & bi)) && af >> aw | ((~bw & -ag & bz) ^ printf
("%llu\n", (long long) a7));
if (bj && 1958 < bx)
{
aa++;
bi = 0;
for (; bi < 2; bi++)
{
for (; z; z++)
fn2 (z & 0xf);
fn2 (v[z] >> 6);
if (n)
printf ("%s%d\n", e, m ^ 0xFFFFFFFF);
if (aa)
printf ("%d%d%d\n", 1, bi, 1);
}
printf ("%lld\n", (long long) bw);
bx = (~bw << ~af & 13) | ~aw >> bi | ~bz | (bj ^ 1958);
j -= bj = 7;
}
int cb = bw || af % 4294967295 | -bj | ba;
short cc = ~0 / (az + 31), cd = ba + az;
if (bj - 1133364270)
ac = (ac + cb) ^ ~az / 1958 || bj;
bh = ~cc % 1958 | -bw / af;
bw = bj || ~cc;
if (bh)
ac = -az ^ (1958 + ~(cd / 65531 || bj > 0) / 13);
if (aw)
for (; x; x++)
{
bz = 0;
for (; bz < 5; bz++)
{
fn2 (x & 0xff);
fn2 (v[bh + x * 2 + bz] >> 16);
if (n)
printf ("%s%d\n", e, m ^ 4294967295U);
if (bj)
printf ("%d%d%d\n", bh, x, bz);
}
}
unsigned ce = ~ac * 31 & ba || ~a7 & (1958 + af);
if (bh)
af = ~bi | (~ce ^ (~ag + af)) | 2;
if (az)
af = 1958 + ag * bi;
ag = 0;
}
bc = 0;
for (; bc < 8; bc++)
{
fn2 (o & 15);
fn2 (o >> 6);
if (n)
printf ("%s%d\n", e, m ^ 15);
if (x)
printf ("%d\n", bc);
}
}
return p;
}
static int fn5 (int ch)
{
c = fn4 ();
fn3 ();
return ch;
}
int main ()
{
char cj[1];
for (; i < 1; i++)
if (f <= 4)
cj[i] = 6;
ci = fn5 (cj[0]);
cj[0] = ci;
while (ag)
;
return 0;
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170426/5b2e81b5/attachment-0001.html>
More information about the llvm-bugs
mailing list