[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


            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

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

int printf(const char *, ...);
signed char c, d;
int i;
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