<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 --- - Bad instruction crash in built code, using -fsanitize=undefined-trap with libstdc++"
href="http://llvm.org/bugs/show_bug.cgi?id=15519">15519</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Bad instruction crash in built code, using -fsanitize=undefined-trap with libstdc++
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>bugzilla@jwwalker.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Overview: Building certain code with the flags
-fsanitize-undefined-trap-on-error -fsanitize=undefined-trap and using
libstdc++ produces a bad instruction error at run time.
Steps to Reproduce:
1. Create a main.cpp file containing this code:
#include <iostream>
int main(int argc, const char * argv[])
{
std::cout.setf( std::ios::hex, std::ios::basefield );
return 0;
}
2. Compile:
clang -arch i386 -stdlib=libstdc++ -fsanitize-undefined-trap-on-error
-fsanitize=undefined-trap -c main.cpp -o main.o
3. Link:
clang++ -arch i386 -stdlib=libstdc++ main.o
4. Execute:
./a.out
Actual Results:
There is a bad instruction crash in ios_base.h. Backtrace:
0 a.out 0x000c17f9
std::operator&=(std::_Ios_Fmtflags&, std::_Ios_Fmtflags) + 57
1 a.out 0x000c16d6
std::ios_base::setf(std::_Ios_Fmtflags, std::_Ios_Fmtflags) + 342
2 a.out 0x000c1406 main + 134
3 a.out 0x000c1375 start + 53
Expected Results:
No error and no output.
Build version and platform:
clang version 3.3 (trunk 177113)
Mac OS X 10.7.5 with Xcode 4.6
Additional Information:
When using libc++ instead of libstdc++, the crash does not occur.</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>