[LLVMbugs] [Bug 11535] New: Clang miscompiles simple C code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Dec 10 17:15:32 PST 2011


             Bug #: 11535
           Summary: Clang miscompiles simple C code
           Product: clang
           Version: 3.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: ambrop7 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 7709
  --> http://llvm.org/bugs/attachment.cgi?id=7709
Test case C program

Clang 3.0 with -O2 miscompiles the attached C code on Linux x86_64.
Correct result is "x=1"; with clang instead it prints "x=2".
Clang 2.9 is not affected.

It appears that the value of 'x' printed is as if it was incremented a second
time (which it must not be). Some evidence of this is that if you change
"pos++" to "pos += 4" for instance, it prints out "x=8" (instead of "x=4").

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