<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63516>63516</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`clangtk` crashes at inline assembly with `-fopenmp-simd` enabled
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
wierton
</td>
</tr>
</table>
<pre>
The bug triggering program:
```
void b(long a) {
asm volatile("" :: "r"(a) : "x10");
}
```
When compile it using `clangtk` with option `-O0 -fopenmp-simd`, `clangtk` triggers assertion failure, this can be verified on https://gcc.godbolt.org/z/P1KnosvsY
Compiler's output from gcc.godbolt.org:
```
clang: /root/llvm-project/clang/lib/Basic/TargetInfo.cpp:675: llvm::StringRef clang::TargetInfo::getNormalizedGCCRegisterName(llvm::StringRef, bool) const: Assertion `isValidGCCRegisterName(Name) && "Invalid register passed in"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang -gdwarf-4 -g -o /app/output.s -S --gcc-toolchain=/opt/compiler-explorer/gcc-9.2.0 -fcolor-diagnostics -fno-crash-diagnostics -O0 -fopenmp-simd <source>
1. <eof> parser at end of file
2. <source>:1:6: LLVM IR generation of declaration 'b'
3. <source>:1:6: Generating code for declaration 'b'
#0 0x0000562fa3b5c93f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c5293f)
#1 0x0000562fa3b5a6ac llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c506ac)
#2 0x0000562fa3aa4d98 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f3903e1f420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007f39038ec00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007f39038cb859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007f39038cb729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007f39038dcfd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x0000562fa7f10379 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x8006379)
#9 0x0000562fa3e8232e clang::CodeGen::CodeGenFunction::EmitAsmStmt(clang::AsmStmt const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f7832e)
#10 0x0000562fa3e8529b clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f7b29b)
#11 0x0000562fa3e8ba04 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f81a04)
#12 0x0000562fa3eeb99a clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fe199a)
#13 0x0000562fa3eff5cf clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3ff55cf)
#14 0x0000562fa3f64539 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x405a539)
#15 0x0000562fa3f5f4e5 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x40554e5)
#16 0x0000562fa3f600b8 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x40560b8)
#17 0x0000562fa3f68f03 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#18 0x0000562fa4dd5fe6 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#19 0x0000562fa4dc8090 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4ebe090)
#20 0x0000562fa62ce4b4 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63c44b4)
#21 0x0000562fa4dd2ec8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4ec8ec8)
#22 0x0000562fa461d799 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4713799)
#23 0x0000562fa45a30e6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x46990e6)
#24 0x0000562fa4701eb6 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x47f7eb6)
#25 0x0000562fa100002d cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x10f602d)
#26 0x0000562fa0ffbd2a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#27 0x0000562fa44037ed 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
#28 0x0000562fa3aa52a0 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b9b2a0)
#29 0x0000562fa4403e0f 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
#30 0x0000562fa43caf7c clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44c0f7c)
#31 0x0000562fa43cba0d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44c1a0d)
#32 0x0000562fa43d3aed clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44c9aed)
#33 0x0000562fa0ffe28a clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x10f428a)
#34 0x0000562fa0f045a5 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xffa5a5)
#35 0x00007f39038cd083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#36 0x0000562fa0ff6b0e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x10ecb0e)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWt1v2zgS_2uUF8IGRerzIQ-O0_S6190tmqKLezIociTzKpECSaXJ_vUHSkpiKnYv6XkPBxzQD4sfw_n9ZjgzIsWslY0CuIzSqyi9vmCD22tz-V2CcVpdVFo8XH7ZA6qGBjkjmwaMVA3qjW4M6yK6ifB1hDdRhuc_4-OdlgJVESlarRrEI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