aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/macosx/lc-note
diff options
context:
space:
mode:
authorHaoren Wang <43286339+MetalOxideSemi@users.noreply.github.com>2026-02-07 20:00:30 +0800
committerGitHub <noreply@github.com>2026-02-07 13:00:30 +0100
commit9e8caa78349f21ba6f27e718d7f8461c8dcfd809 (patch)
tree42b0ae8f4861bb41b43dea90a15f57a829c7be1e /lldb/test/API/macosx/lc-note
parent8d2078332c23b10dcf3571adc1a186e5c65f82df (diff)
downloadllvm-main.zip
llvm-main.tar.gz
llvm-main.tar.bz2
[SelectionDAG] Fix null pointer dereference in resolveDanglingDebugInfo (#174341)HEADmain
## Summary Fix null pointer dereference in `SelectionDAGBuilder::resolveDanglingDebugInfo`. ## Problem `Val.getNode()->getIROrder()` is called before checking if `Val.getNode()` is null, causing crashes when compiling code with debug info that contains aggregate constants with nested empty structs. ## Solution Move the `ValSDNodeOrder` declaration inside the `if (Val.getNode())` block. ## Test Case Reproduces with aggregate types containing nested empty structs: ```llvm %3 = insertvalue { { i1, {} }, ptr, { { {} }, { {} } }, i64 } { { i1, {} } zeroinitializer, ptr null, { { {} }, { {} } } zeroinitializer, i64 2 }, ptr %2, 1, !dbg !893 ## Crash stack 0. Program arguments: llc-20 -O3 -mcpu=native -relocation-model=pic -filetype=obj /cloudide/workspace/temp/sf.ll -o /dev/null 1. Running pass 'Function Pass Manager' on module '/cloudide/workspace/temp/sf.ll'. 2. Running pass 'X86 DAG->DAG Instruction Selection' on function '@filter_create' Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it): 0 libLLVM.so.20.1 0x00007ff87ebbdf86 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 54 1 libLLVM.so.20.1 0x00007ff87ebbbb90 llvm::sys::RunSignalHandlers() + 80 2 libLLVM.so.20.1 0x00007ff87ebbe640 3 libpthread.so.0 0x00007ff87db79140 4 libLLVM.so.20.1 0x00007ff87f3fd2ff llvm::SelectionDAGBuilder::resolveDanglingDebugInfo(llvm::Value const*, llvm::SDValue) + 303 5 libLLVM.so.20.1 0x00007ff87f3fda5e llvm::SelectionDAGBuilder::getValue(llvm::Value const*) + 142 6 libLLVM.so.20.1 0x00007ff87f3fe79f llvm::SelectionDAGBuilder::getValueImpl(llvm::Value const*) + 3343 7 libLLVM.so.20.1 0x00007ff87f3fda34 llvm::SelectionDAGBuilder::getValue(llvm::Value const*) + 100 8 libLLVM.so.20.1 0x00007ff87f3fc1ab llvm::SelectionDAGBuilder::visitInsertValue(llvm::InsertValueInst const&) + 603 9 libLLVM.so.20.1 0x00007ff87f3eeaf7 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) + 327 10 libLLVM.so.20.1 0x00007ff87f4904b8 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true, llvm::BasicBlock>, false, true>, llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true, llvm::BasicBlock>, false, true>, bool&) + 72 11 libLLVM.so.20.1 0x00007ff87f490304 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 5956 12 libLLVM.so.20.1 0x00007ff87f48e2b4 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 372 13 libLLVM.so.20.1 0x00007ff87f48c689 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) + 169 14 libLLVM.so.20.1 0x00007ff87efb8e32 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 610 15 libLLVM.so.20.1 0x00007ff87ed104be llvm::FPPassManager::runOnFunction(llvm::Function&) + 638 16 libLLVM.so.20.1 0x00007ff87ed15ff3 llvm::FPPassManager::runOnModule(llvm::Module&) + 51 17 libLLVM.so.20.1 0x00007ff87ed10c11 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1105 18 llc-20 0x000055972ce77dc1 main + 9649 19 libc.so.6 0x00007ff87d68ad7a __libc_start_main + 234 20 llc-20 0x000055972ce7247a _start + 42 ``` ## Testing Added regression tests in: - `CodeGen/X86/selectiondag-dbgvalue-null-crash.ll` - `CodeGen/AArch64/selectiondag-dbgvalue-null-crash.ll` **Note:** Tests appear to expose deeper issues in DWARF generation on certain targets (Darwin targets for example) that require further investigation. ## Related PRs This supersedes: - #173500 - Initial fix, reverted due to test failures on Darwin and other platforms - #173836 - Second attempt with `UNSUPPORTED: system-darwin`, still failed on some targets
Diffstat (limited to 'lldb/test/API/macosx/lc-note')
0 files changed, 0 insertions, 0 deletions