Issue 62859
Summary [clang] ICE on target_clone attribute
Labels new issue
Assignees
Reporter sorokin
    This code causes internal compiler error:
```
__attribute__((target_clones("default", "arch=x86-64-v3"))) 
int foo(int a, int b)
{
    return a & ~b;
}
```
https://godbolt.org/z/ozenWE1Kd

The error message:
```
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-16.0.0/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-12.2.0 -fcolor-diagnostics -fno-crash-diagnostics -O2 <source>
1.	<eof> parser at end of file
2.	Per-file LLVM IR generation
 #0 0x000056494af7d8df llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x3ba18df)
 #1 0x000056494af7b90c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x3b9f90c)
 #2 0x000056494aece518 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f1d0ac76420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x000056494ee1501d llvm::X86::getFeaturePriority(llvm::X86::ProcessorFeatures) (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x7a3901d)
 #5 0x000056494ee04dff clang::targets::X86TargetInfo::multiVersionSortPriority(llvm::StringRef) const (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x7a28dff)
 #6 0x000056494b470fa7 TargetMVPriority(clang::TargetInfo const&, clang::CodeGen::CodeGenFunction::MultiVersionResolverOption const&) CodeGenModule.cpp:0:0
 #7 0x000056494b49aa95 void std::__merge_adaptive<clang::CodeGen::CodeGenFunction::MultiVersionResolverOption*, long, clang::CodeGen::CodeGenFunction::MultiVersionResolverOption*, __gnu_cxx::__ops::_Iter_comp_iter<clang::CodeGen::CodeGenModule::emitMultiVersionFunctions()::'lambda0'(clang::CodeGen::CodeGenFunction::MultiVersionResolverOption const&, clang::CodeGen::CodeGenFunction::MultiVersionResolverOption const&)>>(clang::CodeGen::CodeGenFunction::MultiVersionResolverOption*, clang::CodeGen::CodeGenFunction::MultiVersionResolverOption*, clang::CodeGen::CodeGenFunction::MultiVersionResolverOption*, long, long, clang::CodeGen::CodeGenFunction::MultiVersionResolverOption*, long, __gnu_cxx::__ops::_Iter_comp_iter<clang::CodeGen::CodeGenModule::emitMultiVersionFunctions()::'lambda0'(clang::CodeGen::CodeGenFunction::MultiVersionResolverOption const&, clang::CodeGen::CodeGenFunction::MultiVersionResolverOption const&)>) CodeGenModule.cpp:0:0
 #8 0x000056494b49aee3 void std::__stable_sort_adaptive<clang::CodeGen::CodeGenFunction::MultiVersionResolverOption*, clang::CodeGen::CodeGenFunction::MultiVersionResolverOption*, long, __gnu_cxx::__ops::_Iter_comp_iter<clang::CodeGen::CodeGenModule::emitMultiVersionFunctions()::'lambda0'(clang::CodeGen::CodeGenFunction::MultiVersionResolverOption const&, clang::CodeGen::CodeGenFunction::MultiVersionResolverOption const&)>>(clang::CodeGen::CodeGenFunction::MultiVersionResolverOption*, clang::CodeGen::CodeGenFunction::MultiVersionResolverOption*, clang::CodeGen::CodeGenFunction::MultiVersionResolverOption*, long, __gnu_cxx::__ops::_Iter_comp_iter<clang::CodeGen::CodeGenModule::emitMultiVersionFunctions()::'lambda0'(clang::CodeGen::CodeGenFunction::MultiVersionResolverOption const&, clang::CodeGen::CodeGenFunction::MultiVersionResolverOption const&)>) CodeGenModule.cpp:0:0
 #9 0x000056494b4cc129 clang::CodeGen::CodeGenModule::emitMultiVersionFunctions() (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x40f0129)
#10 0x000056494b4ce310 clang::CodeGen::CodeGenModule::Release() (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x40f2310)
#11 0x000056494c26f4ba (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
#12 0x000056494c26df3d clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x4e91f3d)
#13 0x000056494d492d5d clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x60b6d5d)
#14 0x000056494c26d865 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x4e91865)
#15 0x000056494bb49671 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x476d671)
#16 0x000056494bacd993 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x46f1993)
#17 0x000056494bc2db3b clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x4851b3b)
#18 0x000056494875641c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x137a41c)
#19 0x0000564948751bdc ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#20 0x000056494b92ece9 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
#21 0x000056494aece977 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x3af2977)
#22 0x000056494b92ef1c 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
#23 0x000056494b8f73fc clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x451b3fc)
#24 0x000056494b8f7ded clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x451bded)
#25 0x000056494b90223c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x452623c)
#26 0x0000564948754523 clang_main(int, char**) (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x1378523)
#27 0x00007f1d0a724083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#28 0x000056494874dd1e _start (/opt/compiler-explorer/clang-16.0.0/bin/clang+++0x1371d1e)
clang-16: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Compiler returned: 139
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to