[LLVMbugs] [Bug 11375] New: Different results for 'clang++ huh.cpp' and 'clang++ -O3 huh.cpp' - Codegen??

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 14 14:41:18 PST 2011


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

             Bug #: 11375
           Summary: Different results for 'clang++ huh.cpp' and 'clang++
                    -O3 huh.cpp'  - Codegen??
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: mclow at qualcomm.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 7609
  --> http://llvm.org/bugs/attachment.cgi?id=7609
Sample program demonstrating the bug

When compiling the attached code (huh.cpp), I get different results when
specifying -O3 vs. -O0


$ clang++ -O0 huh.cpp && ./a.out 
## Test fail on line 111 1 == 0
Returning: 5, 14
Returning: 5, 14
Returning: 5, 14
Returning: 7, 7
Returning: 7, 11
Returning: 5, 15
Returning: 5, 15
Returning: 5, 15
Returning: 9, 9
Returning: 9, 12

$ clang++ -O3 huh.cpp && ./a.out 
## Test fail on line 111 1 == 0
Returning: 5, 12
Returning: 7, 14
Returning: 5, 14
Returning: 7, 7
Returning: 7, 11
Returning: 5, 15
Returning: 5, 15
Returning: 5, 15
Returning: 9, 9
Returning: 9, 12

The first two lines are different!!
gcc gets the same results as -O0 (which I believe is correct).

Platform is x86, Darwin (Mac OS X 10.7.2)
Occurs on:

$ clang++ --version
clang version 3.1 (trunk 144534)
Target: x86_64-apple-darwin11.2.0
Thread model: posix

-- and --

$ clang++ --version
Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin11.2.0
Thread model: posix

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