[llvm-bugs] [Bug 52379] New: wrong code at -O1, -O2, -O3 (but -Os) on x86_64-linux-gnu
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Nov 1 23:10:19 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52379
Bug ID: 52379
Summary: wrong code at -O1, -O2, -O3 (but -Os) on
x86_64-linux-gnu
Product: new-bugs
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: zhendong.su at inf.ethz.ch
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
This appears to be a recent regression.
[508] % clangtk -v
clang version 14.0.0 (https://github.com/llvm/llvm-project.git
8cabd8f0d26c3cff03faec9b1cea974f08618d6d)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/suz-local/opfuzz/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
[509] %
[509] % clangtk -O0 small.c; ./a.out
[510] %
[510] % clangtk -O1 small.c
[511] % ./a.out
Segmentation fault
[512] %
[512] % cat small.c
int printf(const char *, ...);
int a = 354757809, b[2], c, d = 147639773, e, n = 2000;
short f = -25324;
long g;
int main() {
int h = a, k = ~d, m = 0;
a = ~h;
if (a > 3)
goto L2;
a = h;
--d;
e = d;
L1:
d = ~(~48988294629 & ~d * (~48988294629 | ~e));
a = (h | d) ^ ~(e | f) ^ (a - 48988294629);
unsigned l;
if (k)
if (a > 1523073808)
c++;
if (a <= 1523073808)
l = d;
if (a >= 1523073808) {
m = a;
while (a > 1523073808)
;
}
a = m;
L2:
a = l;
if (m)
g = ~a;
if (g > 4073172680703UL) {
printf("%d\n", b[n]);
goto L1;
}
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/20211102/d1ea7f3c/attachment.html>
More information about the llvm-bugs
mailing list