http://llvm.org/bugs/show_bug.cgi?id=15920

            Bug ID: 15920
           Summary: clang -O3 and loops result in garbage value
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

The testcase below produces random output when compiled at -O3 with current
clang trunk (-O2 or below is fine).  Perhaps a bad interaction with the loop
optimizer?

$ clang -v
clang version 3.3 (trunk 181189)
Target: x86_64-pc-linux-gnu
Thread model: posix
$ clang -O2 test.c
$ ./a.out
1
$ clang -O3 test.c
$ ./a.out
2130055448
$

---------------------------
int printf(const char *, ...);
signed char c, d;
int i;
int
main ()
{
    for (c = 0; c > -16; --c)
    {
        int *j = &i;
        *j = 1;
        for (d = 0; d; d = d + 0)
            *j = 0;
    }
    printf ("%d\n", i);
    return 0;
}

-- 
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

Reply via email to