<html>
<head>
<base href="http://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 --- - incorrect compilation with -Os"
href="http://llvm.org/bugs/show_bug.cgi?id=15574">15574</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>incorrect compilation with -Os
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>3.2
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>drefleladi@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=10230" name="attach_10230" title="output of clang -E min-example.cpp">attachment 10230</a> <a href="attachment.cgi?id=10230&action=edit" title="output of clang -E min-example.cpp">[details]</a></span>
output of clang -E min-example.cpp
Dear clang devs,
I hope this is the right place to post a bug report.
You'll find below a simple reproductible example for an incorrect compilation
bug that shows up using -Os on clang 3.2-1 (from the latest ubuntu beta).
Boost is coming from libboost-dev 1.49.0.1 (also from the latest ubuntu beta)
Also, the output of "clang -E min-example.cpp" is attached to the bug report.
Thank you for making such a great product.
Yours Sincerely,
Gurg Hackpof
---------------------------
fred@virtualbuntu:~$ clang++ -std=c++11 -O min-example.cpp -o working
fred@virtualbuntu:~$ ./working
fred@virtualbuntu:~$ clang++ -std=c++11 -Os min-example.cpp -o buggy
fred@virtualbuntu:~$ ./buggy
terminate called after throwing an instance of 'int'
Aborted (core dumped)
fred@virtualbuntu:~$ clang++ -v
Ubuntu clang version 3.2-1~exp5ubuntu2 (tags/RELEASE_32/final) (based on LLVM
3.2)
Target: x86_64-pc-linux-gnu
Thread model: posix
fred@virtualbuntu:~$ cat min-example.cpp
#include <boost/optional.hpp>
struct Parent {
int one;
Parent() : one(1){}
void throwParent(const boost::optional<int>& arg) {
if (one == 1) {
throw 666;
} else {
notUsed(arg);
}
}
virtual void notUsed( const boost::optional<int>& arg) = 0;
};
struct Child : public Parent {
virtual void notUsed( const boost::optional<int>& arg) override {
}
void throwChild() {
throwParent(boost::none);
}
};
int main(){
try {
Child().throwChild();
} catch( int ) {
return 0;
}
}</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>