[llvm-bugs] [Bug 42002] New: output binary crash with clang/llvm 8.0.0 and -fembed-bitcode option
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri May 24 02:02:40 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42002
Bug ID: 42002
Summary: output binary crash with clang/llvm 8.0.0 and
-fembed-bitcode option
Product: clang
Version: 8.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: peter.garba at thalesgroup.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
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
--
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/20190524/5acfd5a2/attachment.html>
More information about the llvm-bugs
mailing list