<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - -Oz miscompilation?"
href="https://llvm.org/bugs/show_bug.cgi?id=31257">31257</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-Oz miscompilation?
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>matthias.krueger@famsik.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>cppcheck testrunner fails under -Oz with clang/llvm dev.
Source: <a href="https://github.com/danmar/cppcheck">https://github.com/danmar/cppcheck</a> (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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>