Open yijan4845 opened 1 hour ago
This testcase is generated by a fuzzer.
Compiler Explorer: https://godbolt.org/z/8ob4qjW47
This valid code will crash on clang assertion trunk:
class S{ public: ~S() __attribute__((noreturn)); void f(); }; extern bool check(const S&); int test(bool value) { if (check(S()); check(S())) { return 1; } return 0; }
It seems that this goes back to clang-3.8.
Stack dump:
Instruction referencing instruction not embedded in a basic block! %ref.tmp1 = alloca %class.S, align 1 %call = invoke noundef zeroext addrspace(0) i1 @_Z5checkRK1S(ptr noundef nonnull align 1 dereferenceable(1) %ref.tmp1) to label %invoke.cont3 unwind label %lpad2, !dbg !22 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-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source> 1. <eof> parser at end of file 2. Optimizer 3. Running pass "verify" on module "<source>" #0 0x0000000003bf66c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3bf66c8) #1 0x0000000003bf43cc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3bf43cc) #2 0x0000000003b419c8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0 #3 0x00007cb33e842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520) #4 0x00000000035d9a21 (anonymous namespace)::Verifier::visitEHPadPredecessors(llvm::Instruction&) Verifier.cpp:0:0 #5 0x00000000035f48ab (anonymous namespace)::Verifier::visitLandingPadInst(llvm::LandingPadInst&) Verifier.cpp:0:0 #6 0x00000000035fcdcd llvm::InstVisitor<(anonymous namespace)::Verifier, void>::visit(llvm::Instruction&) Verifier.cpp:0:0 #7 0x0000000003600d1d void llvm::InstVisitor<(anonymous namespace)::Verifier, void>::visit<llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::BasicBlock, true, false, void, false, void>, false, false>>(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::BasicBlock, true, false, void, false, void>, false, false>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::BasicBlock, true, false, void, false, void>, false, false>) Verifier.cpp:0:0 #8 0x0000000003602797 (anonymous namespace)::Verifier::verify(llvm::Function const&) Verifier.cpp:0:0 #9 0x0000000003604181 llvm::verifyModule(llvm::Module const&, llvm::raw_ostream*, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3604181) #10 0x000000000360420d llvm::VerifierAnalysis::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x360420d) #11 0x000000000524753c llvm::detail::AnalysisPassModel<llvm::Module, llvm::VerifierAnalysis, llvm::AnalysisManager<llvm::Module>::Invalidator>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x524753c) #12 0x00000000035a7471 llvm::AnalysisManager<llvm::Module>::getResultImpl(llvm::AnalysisKey*, llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x35a7471) #13 0x00000000035d9134 llvm::VerifierPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x35d9134) #14 0x0000000003e927ee llvm::detail::PassModel<llvm::Module, llvm::VerifierPass, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e927ee) #15 0x00000000035a7e70 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x35a7e70) #16 0x0000000003ea38eb (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&, clang::BackendConsumer*) BackendUtil.cpp:0:0 #17 0x0000000003ea7115 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ea7115) #18 0x00000000045721de clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45721de) #19 0x0000000006718dac clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6718dac) #20 0x00000000045725c8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45725c8) #21 0x000000000482d559 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x482d559) #22 0x00000000047ac7ce clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x47ac7ce) #23 0x000000000491335e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x491335e) #24 0x0000000000ce9aff cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xce9aff) #25 0x0000000000ce17ba ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0 #26 0x00000000045b57c9 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 #27 0x0000000003b41e74 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b41e74) #28 0x00000000045b5dbf 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 #29 0x000000000457c0ad clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x457c0ad) #30 0x000000000457d19d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x457d19d) #31 0x0000000004584555 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4584555) #32 0x0000000000ce6999 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xce6999) #33 0x0000000000bb3494 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbb3494) #34 0x00007cb33e829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90) #35 0x00007cb33e829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40) #36 0x0000000000ce126e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xce126e) clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation) Compiler returned: 139
@llvm/issue-subscribers-clang-codegen
Author: Yihan Yang (yijan4845)
This testcase is generated by a fuzzer.
Compiler Explorer: https://godbolt.org/z/8ob4qjW47
This valid code will crash on clang assertion trunk:
It seems that this goes back to clang-3.8.
Stack dump: