<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - output binary crash with clang/llvm 8.0.0 and -fembed-bitcode option"
href="https://bugs.llvm.org/show_bug.cgi?id=42002">42002</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>output binary crash with clang/llvm 8.0.0 and -fembed-bitcode option
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>8.0
</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>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>peter.garba@thalesgroup.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Hi,
I found a bug in clang 8.0.0
When you compile with the "-fembed-bitcode" option it will lead to a crash when
executing the output binary.
For unknown reason the assembled x86 code is different when the
"-fembed-bitcode" option is supplied.
It works with clang 7.0.1
a.cpp:
#include <string>
#include <iostream>
int func(int a);
int main(int argc, char **argv) {
std::string s = std::to_string(func(argc));
std::cout << s << std::endl;
return 0;
}
b.cpp:
int func(int a) {
return a+1;
}
Compile with:
=> clang++-8 a.cpp b.cpp -fembed-bitcode && ./a.out
and it fails:
=> [1] 14811 segmentation fault (core dumped) ./a.out
Compile with:
=> clang++-8 a.cpp b.cpp && ./a.out
and it works:
=> 2</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>