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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to