rupprecht wrote:
This is causing test failures in some build modes (I think release build modes
hide it) for the attr-cpuspecific tests. ubsan explains it:
```
$ clang -cc1 -emit-llvm -o /dev/null clang/test/CodeGen/attr-cpuspecific.c
clang/lib/CodeGen/CGStmt.cpp:662:12: runtime error: member call on null pointer
of type 'llvm::Function'
#0 0x5633c492a531 in
clang::CodeGen::CodeGenFunction::EmitBlock(llvm::BasicBlock*, bool)
clang/lib/CodeGen/CGStmt.cpp:662:12
#1 0x5633c479a5a4 in clang::CodeGen::CodeGenFunction::EmitTrapCall(unsigned
int) clang/lib/CodeGen/CGExpr.cpp:4645:5
#2 0x5633c4be52ac in
clang::CodeGen::CodeGenFunction::EmitX86MultiVersionResolver(llvm::Function*,
llvm::ArrayRef<clang::CodeGen::CodeGenFunction::FMVResolverOption>)
clang/lib/CodeGen/CodeGenFunction.cpp:3350:30
#3 0x5633c4be4d01 in
clang::CodeGen::CodeGenFunction::EmitMultiVersionResolver(llvm::Function*,
llvm::ArrayRef<clang::CodeGen::CodeGenFunction::FMVResolverOption>)
clang/lib/CodeGen/CodeGenFunction.cpp:3076:5
#4 0x5633c4c14f4b in
clang::CodeGen::CodeGenModule::emitCPUDispatchDefinition(clang::GlobalDecl)
clang/lib/CodeGen/CodeGenModule.cpp:5295:7
#5 0x5633c4c12482 in
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
clang/lib/CodeGen/CodeGenModule.cpp:4608:12
#6 0x5633c4c0b018 in
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
clang/lib/CodeGen/CodeGenModule.cpp:7929:5
#7 0x5633c4dc7946 in (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
clang/lib/CodeGen/ModuleBuilder.cpp:201:18
#8 0x5633c470dd5b in
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
clang/lib/CodeGen/CodeGenAction.cpp:179:8
#9 0x5633c5b3eb28 in clang::ParseAST(clang::Sema&, bool, bool)
clang/lib/Parse/ParseAST.cpp:174:31
#10 0x5633c5a273b3 in clang::ASTFrontendAction::ExecuteAction()
clang/lib/Frontend/FrontendAction.cpp:1464:3
#11 0x5633c4714128 in clang::CodeGenAction::ExecuteAction()
clang/lib/CodeGen/CodeGenAction.cpp:1166:30
#12 0x5633c5a269c9 in clang::FrontendAction::Execute()
clang/lib/Frontend/FrontendAction.cpp:1344:3
#13 0x5633c59a47ec in
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
clang/lib/Frontend/CompilerInstance.cpp:1033:33
#14 0x5633c470d1b9 in
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:319:25
#15 0x5633c46fb388 in cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) clang/tools/driver/cc1_main.cpp:296:13
```
w/o ubsan:
```
Stack dump:
0. Program arguments: clang -cc1 -emit-llvm -o /dev/null
clang/test/CodeGen/attr-cpuspecific.c
1. clang/test/CodeGen/attr-cpuspecific.c:64:1
<Spelling=clang/test/CodeGen/attr-cpuspecific.c:8:17>: current parser token
'__attribute__'
2. clang/test/CodeGen/attr-cpuspecific.c:44:6: LLVM IR generation of
declaration 'SingleVersion'
```
Similar for attr-cpuspecific.cpp and attr-cpuspecific-outoflinedefs.cpp
https://github.com/llvm/llvm-project/pull/197789
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits