[LLVMbugs] [Bug 12901] New: likely wrong code bug
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun May 20 20:56:51 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=12901
Bug #: 12901
Summary: likely wrong code bug
Product: new-bugs
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: regehr at cs.utah.edu
CC: chenyang at cs.utah.edu, llvmbugs at cs.uiuc.edu
Classification: Unclassified
No idea what's going on here but I think the code is legit and that LLVM should
not be changing its answer.
[regehr at dyson r55]$ clang -O0 small.c ; ./a.out
1
[regehr at dyson r55]$ clang -O1 small.c ; ./a.out
0
[regehr at dyson r55]$ current-gcc -O3 small.c ; ./a.out
1
[regehr at dyson r55]$ cat small.c
int printf (const char *, ...);
int a, b = 1, c, e, f, h, i, j;
int *d = &c, *g = &c;
void fn1 (int *p1)
{
*p1 = *d;
}
void fn2 (int *p1)
{
f = *p1;
*g = f;
}
int main ()
{
int *k = &b, *l = &b;
h = 1;
for (; h; h--)
for (; j <= 0; j++)
{
int **m = &l;
for (; i <= 0; i++)
*l = 0;
*k ^= 1;
*m = 0;
}
e = b;
fn2 (&e);
fn1 (&a);
printf ("%d\n", a);
return 0;
}
[regehr at dyson r55]$ clang -v
clang version 3.2 (trunk 157145)
Target: x86_64-unknown-linux-gnu
Thread model: posix
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list