Michael137 wrote:

> Crash report from clang/test/CodeGen/cfi-check-fail-debuginfo.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: clang -cc1 -internal-isystem 
> /usr/local/lib/clang/21/include -nostdsysteminc -triple x86_64-unknown-linux 
> -O2 -fsanitize-cfi-cross-dso 
> -fsanitize=cfi-icall,cfi-nvcall,cfi-vcall,cfi-unrelated-cast,cfi-derived-cast 
> -fsanitize-trap=cfi-icall,cfi-nvcall 
> -fsanitize-recover=cfi-vcall,cfi-unrelated-cast 
> -fsanitize-annotate-debug-info=cfi-icall,cfi-nvcall,cfi-vcall,cfi-unrelated-cast,cfi-derived-cast
>  -fdebug-prefix-map=clang/test/CodeGen/= -fno-ident 
> -fdebug-compilation-dir=clang/test/CodeGen -debug-info-kind=limited 
> -emit-llvm -o - clang/test/CodeGen/cfi-check-fail-debuginfo.c
> 1.    <eof> parser at end of file
> 2.    Per-file LLVM IR generation
>  #0 0x0000000105c88648 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) 
> (/usr/local/bin/clang-21+0x10550c648)
>  #1 0x0000000105c88c28 PrintStackTraceSignalHandler(void*) 
> (/usr/local/bin/clang-21+0x10550cc28)
>  #2 0x0000000105c86950 llvm::sys::RunSignalHandlers() 
> (/usr/local/bin/clang-21+0x10550a950)
>  #3 0x0000000105c89570 SignalHandler(int, __siginfo*, void*) 
> (/usr/local/bin/clang-21+0x10550d570)
>  #4 0x0000000190dfe584 (/usr/lib/system/libsystem_platform.dylib+0x18047a584)
>  #5 0x00000001009eb0cc llvm::MDNode::getNumOperands() const 
> (/usr/local/bin/clang-21+0x10026f0cc)
>  #6 0x00000001009eb0cc llvm::MDNode::getNumOperands() const 
> (/usr/local/bin/clang-21+0x10026f0cc)
>  #7 0x00000001009eac10 llvm::MDNode::getOperand(unsigned int) const 
> (/usr/local/bin/clang-21+0x10026ec10)
>  #8 0x0000000101ee1aec llvm::DILocation::getRawScope() const 
> (/usr/local/bin/clang-21+0x101765aec)
>  #9 0x0000000101ee1a44 llvm::DILocation::getScope() const 
> (/usr/local/bin/clang-21+0x101765a44)
> #10 0x0000000101eddecc llvm::DILocation::getFile() const 
> (/usr/local/bin/clang-21+0x101761ecc)
> #11 0x000000010673a8c4 
> clang::CodeGen::CGDebugInfo::CreateSyntheticInlineAt(llvm::DebugLoc, 
> llvm::StringRef) (/usr/local/bin/clang-21+0x105fbe8c4)
> # 12 0x000000010673aa44 
> clang::CodeGen::CGDebugInfo::CreateTrapFailureMessageFor(llvm::DebugLoc, 
> llvm::StringRef, llvm::StringRef) (/usr/local/bin/clang-21+0x105fbea44)
> #13 0x0000000106974838 
> clang::CodeGen::CodeGenFunction::EmitTrapCheck(llvm::Value*, 
> clang::CodeGen::SanitizerHandler, bool, llvm::StringRef, llvm::StringRef) 
> (/usr/local/bin/clang-21+0x1061f8838)
> #14 0x0000000106975f7c clang::CodeGen::CodeGenFunction::EmitCfiCheckFail() 
> (/usr/local/bin/clang-21+0x1061f9f7c)
> #15 0x0000000106d7c138 clang::CodeGen::CodeGenModule::Release() 
> (/usr/local/bin/clang-21+0x106600138)
> #16 0x0000000106fabea8 (anonymous 
> namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) 
> (/usr/local/bin/clang-21+0x10682fea8)
> #17 0x0000000106d412e4 
> clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) 
> (/usr/local/bin/clang-21+0x1065c52e4)
> #18 0x00000001094ea118 clang::ParseAST(clang::Sema&, bool, bool) 
> (/usr/local/bin/clang-21+0x108d6e118)
> #19 0x00000001078c808c clang::ASTFrontendAction::ExecuteAction() 
> (/usr/local/bin/clang-21+0x10714c08c)
> #20 0x0000000106d47344 clang::CodeGenAction::ExecuteAction() 
> (/usr/local/bin/clang-21+0x1065cb344)
> #21 0x00000001078c78fc clang::FrontendAction::Execute() 
> (/usr/local/bin/clang-21+0x10714b8fc)
> #22 0x00000001077df330 
> clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) 
> (/usr/local/bin/clang-21+0x107063330)
> # 23 0x0000000107a0a724 
> clang::ExecuteCompilerInvocation(clang::CompilerInstance*) 
> (/usr/local/bin/clang-21+0x10728e724)
> #24 0x000000010078e178 cc1_main(llvm::ArrayRef<char const*>, char const*, 
> void*) (/usr/local/bin/clang-21+0x100012178)
> #25 0x000000010077f93c ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, 
> llvm::ToolContext const&) (/usr/local/bin/clang-21+0x10000393c)
> #26 0x000000010077e5e4 clang_main(int, char**, llvm::ToolContext const&) 
> (/usr/local/bin/clang-21+0x1000025e4)
> #27 0x00000001007bacb8 main (/usr/local/bin/clang-21+0x10003ecb8)
> #28 0x0000000190a43154 
> Error: Failed to update test clang/test/CodeGen/cfi-check-fail-debuginfo.c
> ```

In the debugger this is what i'm seeing:
```
(lldb) 
frame #6: 0x000000010114d614 
clang`clang::CodeGen::CGDebugInfo::CreateSyntheticInlineAt(this=0x0000000a8ed10000,
 Location=DebugLoc @ 0x000000016fdf0a38, FuncName="__clang_trap_msg$Undefined 
Behavior Sanitizer$Control flow integrity check failed") at 
CGDebugInfo.cpp:3790:51
   3787 llvm::DILocation *CGDebugInfo::CreateSyntheticInlineAt(llvm::DebugLoc 
Location,
   3788                                                        StringRef 
FuncName) {
   3789   llvm::DISubprogram *SP =
-> 3790       createInlinedSubprogram(FuncName, Location->getFile());
   3791   return llvm::DILocation::get(CGM.getLLVMContext(), /*Line=*/0, 
/*Column=*/0,
   3792                                /*Scope=*/SP, /*InlinedAt=*/Location);
   3793 }
(lldb) v Location
(llvm::DebugLoc) Location = {
  Loc = {
    Ref = {
      MD = nullptr
    }
  }
}
```

So looks like `Builder.getCurrentDebugLocation()` returned a nullptr. Though 
I'm not sure we want a nullptr check here. Could be that we're not updating the 
current debug-info location correctly.

https://github.com/llvm/llvm-project/pull/145967
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to