[LLVMbugs] [Bug 15920] New: clang -O3 and loops result in garbage value

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon May 6 13:06:19 PDT 2013


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: unassignedclangbugs at nondot.org
          Reporter: dhazeghi at yahoo.com
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130506/e16f1d12/attachment.html>


More information about the llvm-bugs mailing list