[llvm-bugs] [Bug 31257] New: -Oz miscompilation?

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Dec 4 04:49:15 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=31257

            Bug ID: 31257
           Summary: -Oz miscompilation?
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: matthias.krueger at famsik.de
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

cppcheck testrunner fails under -Oz with clang/llvm dev.

Source: https://github.com/danmar/cppcheck (tested with 9c69546 of this repo)
To compile and run just execute
make CXX=clang++ CXXFLAGS="-Oz -std=c++0x" testrunner; ./testrunner

With clang 3.8.0 (fedora 24) there are no problems, testrunner succeeds.

With 4.0-dev however there are assertion failures and internal errors which
makes be believe that there is a miscompilation of the compiler.

test failures:

TestType  
TestSymbolDatabase
TestOther 
TestNullPointer 
TestMathLib 
TestCondition 
TestCharVar


internal errors:

TestBufferOverrun 
TestValueFlow  
TestTokenizer
TestSimplifyTokens 


you can run tests one by one via
./testrunner TestValueFlow
or
./testrunner TestValueFlow::valueFlowCalculations

My rough assumption is that there are differences in how -Oz handles data types
or related checks since in the test suit, some values that were ints became
floats unexpectedly ( ./testrunner TestMathLib )

If you want to know how cppcheck interprets code, run cppcheck file --debug
--verbose

My knowledge of c/c++ is very limited so unfortunately I can't come up with a
reduced example of miscompiled code.

-O0, -O1, -O2, -O3, -Og -Os all show no sign of failures.

llvm @ r288619 
clang @ r288614

-- 
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/20161204/38c49939/attachment.html>


More information about the llvm-bugs mailing list