clang++ crashes on assembly with cfi directives
| Bugzilla Link | 13754 |
| Resolution | FIXED |
| Resolved on | Sep 07, 2012 10:01 |
| Version | trunk |
| OS | Linux |
| CC | @d0k,@chandlerc,@KernelAddress,@kcc |
Extended Description
$ clang++ -v clang version 3.2 (trunk 163014) Target: x86_64-unknown-linux-gnu Thread model: posix
$ cat tmp.S .section .text .globl thunk thunk: .cfi_startproc push %rbx .cfi_adjust_cfa_offset 8 .cfi_rel_offset %rbx, 0 mov %rsp, %rbx .cfi_def_cfa_register rbx call switch .cfi_def_cfa_register rsp pop %rbx .cfi_adjust_cfa_offset -8 .cfi_endproc ret
$ g++ -c tmp.S
$ clang++ -c tmp.S
clang: /usr/local/google/home/dvyukov/llvm0/lib/Target/X86/AsmParser/X86AsmParser.cpp:519: virtual bool
- Program arguments: -triple x86_64-unknown-linux-gnu -filetype obj -o tmp.o /tmp/tmp-mPHJLn.s 0 clang 0x0000000001f7bfef 1 clang 0x0000000001f7defa 2 libpthread.so.0 0x00007f4c62bcd8f0 3 libc.so.6 0x00007f4c621d0a75 gsignal + 53 4 libc.so.6 0x00007f4c621d45c0 abort + 384 5 libc.so.6 0x00007f4c621c9941 __assert_fail + 241 6 clang 0x0000000001704634 7 clang 0x00000000019aa89b 8 clang 0x00000000019b6211 9 clang 0x00000000019b7289 10 clang 0x000000000065ce20 11 clang 0x000000000065dfd5 cc1as_main(char const**, char const**, char const*, void*) + 1845 12 clang 0x0000000000662115 main + 7909 13 libc.so.6 0x00007f4c621bbc4d __libc_start_main + 253 14 clang 0x0000000000656999 clang: error: unable to execute command: Aborted (core dumped) clang: error: clang integrated assembler command failed due to signal (use -v to see invocation) clang version 3.2 (trunk 163014) Target: x86_64-unknown-linux-gnu Thread model: posix clang: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script. clang: note: diagnostic msg:
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang: note: diagnostic msg: /tmp/tmp-cq3Ud1 clang++: /usr/local/google/home/dvyukov/llvm0/tools/clang/lib/Driver/Driver.cpp:558: void clang::driver::Driver::generateCompilationDiagnostics(clang::driver::Compilation&, const clang::driver::Command*): Assertion `I != std::string::npos && "Expected to find -main-file-name"' failed. 0 clang++ 0x0000000001f7bfef 1 clang++ 0x0000000001f7defa 2 libpthread.so.0 0x00007fde8d3d58f0 3 libc.so.6 0x00007fde8c9d8a75 gsignal + 53 4 libc.so.6 0x00007fde8c9dc5c0 abort + 384 5 libc.so.6 0x00007fde8c9d1941 __assert_fail + 241 6 clang++ 0x00000000007108ea clang::driver::Driver::generateCompilationDiagnostics(clang::driver::Compilation&, clang::driver::Command const*) + 7930 7 clang++ 0x00000000006615b9 main + 5001 8 libc.so.6 0x00007fde8c9c3c4d __libc_start_main + 253 9 clang++ 0x0000000000656999 Stack dump: 0. Program arguments: clang++ -c tmp.S Aborted (core dumped)
I'm not sure whether GAS accepts %-less register operands on cfi directives intentionally, but LLVM also accepts them with r163390.
At least there is such code with %-less directives in Internet: http://www.logix.cz/michal/devel/gas-cfi/example.s.xp
I'm not sure whether GAS accepts %-less register operands on cfi directives intentionally, but LLVM also accepts them with r163390.