Issue 242989
Summary Clang crashes due to "Failure value returned from cantFail wrapped call; failed to parse constraints"
Labels clang
Assignees
Reporter haoxintu
    Compiler under test: `clang version 24.0.0git (https://github.com/llvm/llvm-project.git 018b722b2d48cf42dccded46e1226f1d9c29f339)` (`clang` in the commands below)

## Reproduce in Godbolt

https://godbolt.org/z/j9f6qYzd6

## Reproduce locally

```
$ clang -c repro.c 
```

### What happened

```
$ clang -c repro.c 
Failure value returned from cantFail wrapped call
failed to parse constraints
UNREACHABLE executed at /home/haoxin/research/llvm-project/llvm/include/llvm/Support/Error.h:779!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and dumped files.
Stack dump:
0.	Program arguments: clang -c repro.c
1.	<eof> parser at end of file
2.	repro.c:3:6: LLVM IR generation of declaration 'f'
3.	repro.c:3:6: Generating code for declaration 'f'
 #0 0x000055dbcd96b0e9 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x4f010e9)
 #1 0x000055dbcd967ddc llvm::sys::RunSignalHandlers() (/home/haoxin/research/llvm-project/build/bin/clang-21+0x4efdddc)
 #2 0x000055dbcd968698 llvm::sys::CleanupOnSignal(unsigned long) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x4efe698)
 #3 0x000055dbcd89c928 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #4 0x00007f8271042520 (/usr/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #5 0x00007f82710969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #6 0x00007f82710969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #7 0x00007f82710969fc pthread_kill ./nptl/pthread_kill.c:89:10
 #8 0x00007f8271042476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #9 0x00007f82710287f3 abort ./stdlib/abort.c:81:7
#10 0x000055dbcd8a8bbe (/home/haoxin/research/llvm-project/build/bin/clang-21+0x4e3ebbe)
#11 0x000055dbcd17762a llvm::InlineAsm::InlineAsm(llvm::FunctionType*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool, bool, llvm::InlineAsm::AsmDialect, bool) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x470d62a)
#12 0x000055dbcd177e4f llvm::ConstantUniqueMap<llvm::InlineAsm>::getOrCreate(llvm::PointerType*, llvm::InlineAsmKeyType) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x470de4f)
#13 0x000055dbcd178461 llvm::InlineAsm::get(llvm::FunctionType*, llvm::StringRef, llvm::StringRef, bool, bool, llvm::InlineAsm::AsmDialect, bool) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x470e461)
#14 0x000055dbcdff8557 clang::AsmConstraintsInfo::EmitAsmStmt() (/home/haoxin/research/llvm-project/build/bin/clang-21+0x558e557)
#15 0x000055dbcdff9e3e clang::CodeGen::CodeGenFunction::EmitAsmStmt(clang::AsmStmt const&) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x558fe3e)
#16 0x000055dbce0042cc clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x559a2cc)
#17 0x000055dbce06f741 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x5605741)
#18 0x000055dbce0838f4 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x56198f4)
#19 0x000055dbce0ed7a8 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x56837a8)
#20 0x000055dbce0e6e85 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x567ce85)
#21 0x000055dbce0e7803 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x567d803)
#22 0x000055dbce0f2f65 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#23 0x000055dbce4897d1 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#24 0x000055dbce47cdc1 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x5a12dc1)
#25 0x000055dbd194dfac clang::ParseAST(clang::Sema&, bool, bool) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x8ee3fac)
#26 0x000055dbce7de081 clang::FrontendAction::Execute() (/home/haoxin/research/llvm-project/build/bin/clang-21+0x5d74081)
#27 0x000055dbce76675d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x5cfc75d)
#28 0x000055dbce8b487f clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x5e4a87f)
#29 0x000055dbc9f9b477 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x1531477)
#30 0x000055dbc9f912fa ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#31 0x000055dbc9f91493 int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::'lambda'(llvm::SmallVectorImpl<char const*>&)>(long, llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#32 0x000055dbce5047bd void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#33 0x000055dbcd89cd10 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x4e32d10)
#34 0x000055dbce505613 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#35 0x000055dbce4c01d7 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/haoxin/research/llvm-project/build/bin/clang-21+0x5a561d7)
#36 0x000055dbce4c3294 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/haoxin/research/llvm-project/build/bin/clang-21+0x5a59294)
#37 0x000055dbce4d2ae4 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x5a68ae4)
#38 0x000055dbc9f96ac8 clang_main(int, char**, llvm::ToolContext const&) (/home/haoxin/research/llvm-project/build/bin/clang-21+0x152cac8)
#39 0x000055dbc9f1ffaa main (/home/haoxin/research/llvm-project/build/bin/clang-21+0x14b5faa)
#40 0x00007f8271029d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#41 0x00007f8271029e40 call_init ./csu/../csu/libc-start.c:128:20
#42 0x00007f8271029e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#43 0x000055dbc9f90925 _start (/home/haoxin/research/llvm-project/build/bin/clang-21+0x1526925)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 24.0.0git (https://github.com/llvm/llvm-project.git 2451a1eadfa1636510e65c1688b006a0eedf20d8)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/haoxin/research/llvm-project/build/bin
Build config: +assertions
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING CRASH REPRODUCER FILES TO THE BUG REPORT:
clang: note: diagnostic msg: /tmp/repro-5c61d0.c
clang: note: diagnostic msg: /tmp/repro-5c61d0.sh
clang: note: diagnostic msg: 

********************
Aborted
```

### Program (repro.c)

```c
void f(void) {
  int d1, d2;
  asm("%0,%1": "=r" (d1) : "%" (d2));
}
```


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to