<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/115299>115299</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-20 crashed with cpu_specific attribute. Assertion `V != this && "Illegal call to this->takeName(this)!"' failed.
</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-20 crashed with ```cpu_specific``` attribute.
Compiler explorer: https://godbolt.org/z/e7dxPjYd9
```
$cat mutant.c
void __attribute__((cpu_specific(ivybridge))) a (__UINTPTR_TYPE__ x) {}
void b (void)
{
a ((__UINTPTR_TYPE__) a);
}
Also crashed on clang-19.
$clang-19 mutant.c
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: /usr/lib/llvm-19/bin/clang -cc1 -triple x86_64-pc-linux-gnu -emit-obj -dumpdir a- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name mutant.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/code/reduce -fcoverage-compilation-dir=/home/code/reduce -resource-dir /usr/lib/llvm-19/lib/clang/19 -internal-isystem /usr/lib/llvm-19/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/mutant-922ea3.o -x 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 'X86 DAG->DAG Instruction Selection' on function '@b'
#0 0x00007f42ff9e0246 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xea7246)
#1 0x00007f42ff9dde20 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xea4e20)
#2 0x00007f42ff9e090b (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xea790b)
#3 0x00007f42fe618520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007f42ffb89b33 llvm::Value::stripPointerCasts() const (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0x1050b33)
#5 0x00007f42ffac1577 llvm::diagnoseDontCall(llvm::CallInst const&) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xf88577)
#6 0x00007f43000fd6ec llvm::FastISel::lowerCall(llvm::CallInst const*) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0x15c46ec)
#7 0x00007f43000f8e26 llvm::FastISel::selectOperator(llvm::User const*, unsigned int) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0x15bfe26)
#8 0x00007f43000ff5b2 llvm::FastISel::selectInstruction(llvm::Instruction const*) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0x15c65b2)
#9 0x00007f43002796a8 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0x17406a8)
#10 0x00007f4300277e12 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0x173ee12)
#11 0x00007f430027693a llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0x173d93a)
#12 0x00007f42ffdc0738 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0x1287738)
#13 0x00007f42ffb2e6f4 llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xff56f4)
#14 0x00007f42ffb33fe3 llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xffafe3)
#15 0x00007f42ffb2ee4e llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xff5e4e)
#16 0x00007f43084ebc7e 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>>, clang::BackendConsumer*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x1e20c7e)
#17 0x00007f4308891132 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x21c6132)
#18 0x00007f43072fa739 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xc2f739)
#19 0x00007f430938d0b5 clang::FrontendAction::Execute() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2cc20b5)
#20 0x00007f43092fd2f4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2c322f4)
#21 0x00007f4309409dee clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2d3edee)
#22 0x00005609ae370bc5 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm-19/bin/clang+0x11bc5)
#23 0x00005609ae36dad5 (/usr/lib/llvm-19/bin/clang+0xead5)
#24 0x00005609ae36cc9b clang_main(int, char**, llvm::ToolContext const&) (/usr/lib/llvm-19/bin/clang+0xdc9b)
#25 0x00005609ae37af36 main (/usr/lib/llvm-19/bin/clang+0x1bf36)
#26 0x00007f42fe5ffd90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#27 0x00007f42fe5ffe40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#28 0x00005609ae36b765 _start (/usr/lib/llvm-19/bin/clang+0xc765)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Ubuntu clang version 19.0.0 (++20240722031324+65825cd5431c-1~exp1~20240722151445.1819)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin
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/mutant-dd08a9.c
clang: note: diagnostic msg: /tmp/mutant-dd08a9.sh
clang: note: diagnostic msg:
********************
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEWUtz27iT_zT0BQUVCfAhHnyQJStxlTN22U5m56QCgSaFCQlwAdBx9jCffQskZZGK83DGu_-UK5KARvevG_0A0MxaWSmA8yC5CJLNGevcXptzyRqmtPra6M5ye1Zo8fWc10xVmISIG2b3INAX6fYoSMPhj7fdzrbAZSn58yBizhlZdA4WQbgJwtXw_1o3razBIHhqa23ABHSF9s61NqCrgGwDsq20KHTtFtpUAdn-T0C2kImn27__EvmU07Ok8SeJOXOo6RxTbsGHwUctBdrtnqHsdgFZBmQ5Q0yW8vFrYaSoICD58IcYCshyt_t49cfD7cPd7uGv28v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