[llvm-bugs] [Bug 27392] New: wrong code bug
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Apr 17 13:05:59 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27392
Bug ID: 27392
Summary: wrong code bug
Product: new-bugs
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: regehr at cs.utah.edu
CC: llvm-bugs at lists.llvm.org,
sanjoy at playingwithpointers.com
Classification: Unclassified
regehr at hawking:~/test/reduce_wrong_333190$ clang small.c ; ./a.out
-65536
regehr at hawking:~/test/reduce_wrong_333190$ gcc small.c ; ./a.out
-65536
regehr at hawking:~/test/reduce_wrong_333190$ clang small.c -O ; ./a.out
0
regehr at hawking:~/test/reduce_wrong_333190$ cat small.c
int printf(const char *, ...);
short a;
volatile unsigned b;
int main() {
short *c = &a;
lbl:
b--;
(*c)--;
if (a)
goto lbl;
printf("%d\n", b);
return 0;
}
regehr at hawking:~/test/reduce_wrong_333190$ clang -v
clang version 3.9.0 (trunk 266564)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/regehr/llvm-install/bin
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/5.3.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
Sanjoy this looks like it might be an instance of the SCEV issue you already
know about, but I wanted to make sure, since this example came up
independently.
--
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/20160417/b5f316af/attachment.html>
More information about the llvm-bugs
mailing list