New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wrong code at -O3 on x86_64-linux-gnu in 32-bit mode #24909
Comments
Bisection points to r244503:
JF, can you take a look? |
Comparing the new (left) and old (right) code at O3, the only difference is here: decl 0x804a024 decl 0x804a024 |
See potential dup: |
*** This bug has been marked as a duplicate of bug llvm/llvm-bugzilla-archive#25033 *** |
mentioned in issue llvm/llvm-bugzilla-archive#25033 |
Extended Description
The following code is miscompiled by the current clang trunk on x86_64-linux-gnu at -O3 in 32-bit mode (but not in 64-bit mode).
This is a regression from 3.6.x.
$ clang-trunk -v
clang version 3.8.0 (trunk 245675)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
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.4
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.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.1.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-trunk -m32 -O2 small.c; ./a.out
-1
$ clang-trunk -m64 -O3 small.c; ./a.out
-1
$ clang-3.6 -m32 -O3 small.c; ./a.out
-1
$
$ clang-trunk -m32 -O3 small.c
$ ./a.out
127
$
int printf (const char *, ...);
int a, b, d, e, f, g;
char c;
void
fn1 (int p)
{
for (b = 1; b; b = a)
g = c ? c : p ? 0 : a;
}
int
main ()
{
c--;
fn1 (0);
d--;
a = e && f;
d && (e = 0);
printf ("%d\n", c);
return 0;
}
The text was updated successfully, but these errors were encountered: