Open FFreestanding opened 3 days ago
Does it assert in an assertion-enabled build? This looks like user error to me.
Please provide complete stack.
Please provide complete stack.
Thanks. version: llvm-19.1.4
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: opt -debug-pass-manager -load-pass-plugin=build/testpass/testpass.so -passes=testpass -disable-output inputs/test/test.ll
1. Running pass "testpass" on module "inputs/test/test.ll"
#0 0x00007366b861ab72 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/ffreestanding/envs/llvm-19.1.4/build/bin/../lib/libLLVMSupport.so.19.1+0x21ab72)
#1 0x00007366b861779f llvm::sys::RunSignalHandlers() (/home/ffreestanding/envs/llvm-19.1.4/build/bin/../lib/libLLVMSupport.so.19.1+0x21779f)
#2 0x00007366b86178e5 SignalHandler(int) Signals.cpp:0:0
#3 0x00007366b8045320 (/lib/x86_64-linux-gnu/libc.so.6+0x45320)
#4 0x00007366b809eb1c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#5 0x00007366b809eb1c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#6 0x00007366b809eb1c pthread_kill ./nptl/pthread_kill.c:89:10
#7 0x00007366b804526e raise ./signal/../sysdeps/posix/raise.c:27:6
#8 0x00007366b80288ff abort ./stdlib/abort.c:81:7
#9 0x00007366b802881b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007366b803b507 (/lib/x86_64-linux-gnu/libc.so.6+0x3b507)
#11 0x00007366b1fc8cf2 llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::BasicBlock, true, false, void, false, void>, false, false>::operator*() const (build/testpass/testpass.so+0x1c8cf2)
#12 0x00007366b1fc4e25 llvm::simple_ilist<llvm::BasicBlock>::front() (build/testpass/特色他.so+0x1c4e25)
#13 0x00007366b1fc274c llvm::Function::front() (build/testpass/testpass.so+0x1c274c)
#14 0x00007366b1fc272a llvm::Function::getEntryBlock() (build/testpass/testpass.so+0x1c272a)
#15 0x00007366b1fc2861 llvm::GraphTraits<llvm::Function*>::getEntryNode(llvm::Function*) (build/testpass/testpass.so+0x1c2861)
#16 0x00007366b1fcb389 llvm::scc_iterator<llvm::Function*, llvm::GraphTraits<llvm::Function*>>::begin(llvm::Function* const&) (build/testpass/testpass.so+0x1cb389)
#17 0x00007366b1fc68f2 llvm::scc_iterator<llvm::Function*, llvm::GraphTraits<llvm::Function*>> llvm::scc_begin<llvm::Function*>(llvm::Function* const&) (build/testpass/testpass.so+0x1c68f2)
#18 0x00007366b1fbe673 llvm::testpass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (build/testpass/testpass.so+0x1be673)
#19 0x00007366b1ffbadd llvm::detail::PassModel<llvm::Module, llvm::testpass, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (build/testpass/testpass.so+0x1fbadd)
#20 0x00007366b3d58cd5 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/ffreestanding/envs/llvm-19.1.4/build/bin/../lib/../lib/libLLVMCore.so.19.1+0x358cd5)
#21 0x00007366b8737973 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) (/home/ffreestanding/envs/llvm-19.1.4/build/bin/../lib/libLLVMOptDriver.so.19.1+0x2d973)
#22 0x00007366b8743aaa optMain (/home/ffreestanding/envs/llvm-19.1.4/build/bin/../lib/libLLVMOptDriver.so.19.1+0x39aaa)
#23 0x00007366b802a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#24 0x00007366b802a28b call_init ./csu/../csu/libc-start.c:128:20
#25 0x00007366b802a28b __libc_start_main ./csu/../csu/libc-start.c:347:5
#26 0x0000614e81678095 _start (/home/ffreestanding/envs/llvm-19.1.4/build/bin/opt+0x1095)
Aborted (core dumped)
Does it assert in an assertion-enabled build? This looks like user error to me.
It doesn't assert in an assertion-enabled build.
Description
version: llvm-19.1.4, llvm-13 path: llvm-19.1.4/llvm/include/llvm/ADT/SCCIterator.h call
scc_begin
when the llvm::Function is declaration, will trigger crashF
is a decaration:declare i32 @printf(ptr noundef, ...) #1
GT::getEntryNode(G) will return a invalid NodeRef
DFSVisitOne will use it
N is invalid, visit nodeVisitNumbers[N] will crash
Testcase
test.ll
llvm pass code
command