http://llvm.org/bugs/show_bug.cgi?id=9346
Summary: likely memory unsafety error in generated code
Product: new-bugs
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Notice that (due to ASLR or whatever) two runs of the same executable give
different answers. The correct answer is "0".
[regehr@gamow ~]$ clang -v
clang version 2.9 (trunk 126682)
Target: x86_64-unknown-linux-gnu
Thread model: posix
[regehr@gamow ~]$ clang -O2 foo.c -o foo
[regehr@gamow ~]$ ./foo
g_1 = 107756488
[regehr@gamow ~]$ ./foo
g_1 = 1634447976
[regehr@gamow ~]$ cat foo.c
long long g_4 = 0;
static int g_1 = 0;
int printf(const char *format, ...);
static int foo(int i1, int i2)
{
return (i1 % i2);
}
int main (int argc, char* argv[])
{
foo(1, 1);
g_1 = foo((g_4 | -2), -1);
printf("g_1 = %d\n", g_1);
return 0;
}
--
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs