<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/73615>73615</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang-18 crash: error in backend: 64-bit mask registers are not supported without EVEX512.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
iamanonymouscs
</td>
</tr>
</table>
<pre>
Clang-18 with -O2 -march=x86-64 -mavx512bw -mno-evex512 -c crashes on the test case.
Compiler explorer: https://godbolt.org/z/4rqaezqMr
```
$cat mutant.c
#include <immintrin.h>
long long
foo (long long c)
{
register long long a __asm ("k7") = c;
long long b = foo (a);
asm volatile ("" : "+k" (b));
return b;
}
$clang-18 clang-18 -O2 -march=x86-64 -mavx512bw -mno-evex512 -c mutant.c
fatal error: error in backend: 64-bit mask registers are not supported without EVEX512
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: clang-18 -O2 -march=x86-64 -mavx512bw -mno-evex512 -c mutant.c
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'mutant.c'.
4. Running pass 'Greedy Register Allocator' on function '@foo'
#0 0x00007fd5fe491266 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xd2b266)
#1 0x00007fd5fe48f170 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xd29170)
#2 0x00007fd5fe4908c4 llvm::sys::CleanupOnSignal(unsigned long) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xd2a8c4)
#3 0x00007fd5fe3de9ae (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xc789ae)
#4 0x00007fd5fe3de96b (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xc7896b)
#5 0x00007fd5fe48ba67 llvm::sys::Process::Exit(int, bool) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xd25a67)
#6 0x000055f8fc5edc23 (/usr/lib/llvm-18/bin/clang+0x13c23)
#7 0x00007fd5fe3ecc4f llvm::report_fatal_error(llvm::Twine const&, bool) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xc86c4f)
#8 0x00007fd5fe3ecb26 (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xc86b26)
#9 0x00007fd60121630d (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x3ab030d)
#10 0x00007fd5fe6a309a (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xf3d09a)
#11 0x00007fd5fe99bb23 (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x1235b23)
#12 0x00007fd5fe99c128 (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x1236128)
#13 0x00007fd5fe9876df llvm::RegAllocBase::allocatePhysRegs() (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x12216df)
#14 0x00007fd5fe99f4ad (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x12394ad)
#15 0x00007fd5fe845552 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x10df552)
#16 0x00007fd5fe5d70df llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xe710df)
#17 0x00007fd5fe5dcdc3 llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xe76dc3)
#18 0x00007fd5fe5d77d4 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xe717d4)
#19 0x00007fd606c7409f clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x1ade09f)
#20 0x00007fd60700a5fe (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x1e745fe)
#21 0x00007fd605c26866 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xa90866)
#22 0x00007fd607a7e645 clang::FrontendAction::Execute() (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x28e8645)
#23 0x00007fd6079fccc4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x2866cc4)
#24 0x00007fd607af91c0 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x29631c0)
#25 0x000055f8fc5ed837 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm-18/bin/clang+0x13837)
#26 0x000055f8fc5ea905 (/usr/lib/llvm-18/bin/clang+0x10905)
#27 0x00007fd607694909 (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x24fe909)
#28 0x00007fd5fe3de94c llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xc7894c)
#29 0x00007fd6076942ae clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x24fe2ae)
#30 0x00007fd60765c0f1 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x24c60f1)
#31 0x00007fd60765c33e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x24c633e)
#32 0x00007fd60767839c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x24e239c)
#33 0x000055f8fc5ea25c clang_main(int, char**, llvm::ToolContext const&) (/usr/lib/llvm-18/bin/clang+0x1025c)
#34 0x000055f8fc5f7f32 main (/usr/lib/llvm-18/bin/clang+0x1df32)
#35 0x00007fd5fc975c87 __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:344:0
#36 0x000055f8fc5e71ea _start (/usr/lib/llvm-18/bin/clang+0xd1ea)
clang-18: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Ubuntu clang version 18.0.0 (++20231018091808+48a53509e851-1~exp1~20231018091910.1571)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-18: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-18: note: diagnostic msg: /tmp/mutant-3ee3f9.c
clang-18: note: diagnostic msg: /tmp/mutant-3ee3f9.sh
clang-18: note: diagnostic msg:
********************
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8Wktz2zjW_TX0BiUVCPC58EKWrSRdzmeX7c43NRsVCF5KmJCAGgAduRf926fAh0Qo9uSl7pTLIfG6hwcH914AZsaIjQS4DOKrIL6-YK3dKn0pWMOkki-Nag03F4UqXy6XNZObWZihL8Ju0eyOoFnDNN8G9HqfJbMkcu_P-zgkxRc0a6SawTO4VzTjiGtmtmCQk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