llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.97k stars 11.94k forks source link

clang: error: clang frontend command failed due to signal: gcc style inline asm #14802

Closed llvmbot closed 1 year ago

llvmbot commented 11 years ago
Bugzilla Link 14430
Version trunk
OS Linux
Attachments first attachment: preprocessed source, second attachment: command line
Reporter LLVM Bugzilla Contributor
CC @echristo,@stoklund

Extended Description

clang: /home/hotellnx99/peeterj/tmp/clang/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1261: void {anonymous}::TwoAddressInstructionPass::processTiedPairs(l
lvm::MachineInstr*, {anonymous}::TwoAddressInstructionPass::TiedPairList&, unsigned int&): Assertion `i == DstIdx || !MI->getOperand(i).isReg() || MI->getOper
and(i).getReg() != RegA' failed.
0  clang           0x0000000001fae83f
1  clang           0x0000000001faed39
2  libpthread.so.0 0x00002b3ad2e8ee00
3  libc.so.6       0x00002b3ad3541f45 gsignal + 53
4  libc.so.6       0x00002b3ad3543340 abort + 272
5  libc.so.6       0x00002b3ad353b486 __assert_fail + 246
6  clang           0x0000000001a7d235
7  clang           0x0000000001a81fca
8  clang           0x0000000001f45c1f llvm::FPPassManager::runOnFunction(llvm::Function&) + 655
9  clang           0x0000000001f45c73 llvm::FPPassManager::runOnModule(llvm::Module&) + 51
10 clang           0x0000000001f4591f llvm::MPPassManager::runOnModule(llvm::Module&) + 575
11 clang           0x0000000001f4900f llvm::PassManagerImpl::run(llvm::Module&) + 175
12 clang           0x00000000007ed664 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::La
ngOptions const&, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) + 3668
13 clang           0x00000000007eb31f
14 clang           0x0000000000940eba clang::ParseAST(clang::Sema&, bool, bool) + 554
15 clang           0x00000000007e9f1e clang::CodeGenAction::ExecuteAction() + 78
16 clang           0x000000000067c8c6 clang::FrontendAction::Execute() + 150
17 clang           0x000000000065fae5 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 341
18 clang           0x00000000006471fd clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1421
19 clang           0x000000000063f128 cc1_main(char const**, char const**, char const*, void*) + 1160
20 clang           0x00000000006465fa main + 4842
21 libc.so.6       0x00002b3ad352f304 __libc_start_main + 244
22 clang           0x000000000063dff9
Stack dump:
0.      Program arguments: /home/hotellnx99/peeterj/local/bin/clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name t.C -mreloca
tion-model static -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.16.91.0.5 -mom
it-leaf-frame-pointer -resource-dir /home/hotellnx99/peeterj/local/bin/../lib/clang/3.3 -fmodule-cache-path /home/hotellnx99/peeterj/tmp/clang-module-cache -i
nternal-isystem /home/hotellnx99/peeterj/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2 -internal-isystem /home/hotellnx99/peeterj
/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/x86_64-unknown-linux-gnu -internal-isystem /home/hotellnx99/peeterj/local/lib/gcc/
x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/backward -internal-isystem /usr/local/include -internal-isystem /home/hotellnx99/peeterj/local/bi
n/../lib/clang/3.3/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -fdeprecated-macro -fdebug-compilation-dir /vbs/commo
n/osse/core/t -ferror-limit 19 -fmessage-length 0 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o /home/hotellnx9
9/peeterj/tmp/t-tYuE1R.o -x c++ t.C
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 't.C'.
4.      Running pass 'Two-Address instruction pass' on function '@_Z9callcpuidP8cpuidOutl'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 3.3 (trunk 168392)
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 scri
pt.
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: /home/hotellnx99/peeterj/tmp/t-CDxuHx.cpp
clang: note: diagnostic msg: /home/hotellnx99/peeterj/tmp/t-CDxuHx.sh
llvmbot commented 11 years ago

Note that the code in question doesn't actually compile with g++ either:

void callcpuid( cpuidOut * p, long a )
{
//   memset( p, 0xFF, sizeof(*p) ) ;
   p->a = a ;

   __asm__ ( "cpuid"
             : "+a"(p->a), "=b"(p->b), "=c"(p->c), "=d"(p->d)  // output
             :                                                 // no (only) inputs
             : "%rax", "%rbx", "%rcx", "%rdx"                  // clobbered registers
           ) ;
//             : "a", "b", "c", "d"                              // clobbered registers
}

... but gcc produces a diagnostic message instead of trapping.

Endilll commented 1 year ago

Appears to be fixed in Clang 4.0: https://godbolt.org/z/s1M6aEcqv

llvmbot commented 1 year ago

@llvm/issue-subscribers-backend-x86