-
Notifications
You must be signed in to change notification settings - Fork 13.5k
CFG builder asserts when goto jumps variable with nontrivial destructor in MS mode #13325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Part of the general badness with destructors in the CFG. We could disable including destructors in the CFG as workaround, although some warnings depend on that now. |
*** Bug llvm/llvm-bugzilla-archive#17483 has been marked as a duplicate of this bug. *** |
*** Bug llvm/llvm-bugzilla-archive#20048 has been marked as a duplicate of this bug. *** |
mentioned in issue llvm/llvm-bugzilla-archive#13707 |
mentioned in issue llvm/llvm-bugzilla-archive#17483 |
mentioned in issue llvm/llvm-bugzilla-archive#20048 |
Confirmed: https://godbolt.org/z/rGEGW6Y4K Assertion: clang++: /root/llvm-project/clang/lib/Analysis/CFG.cpp:337:
int {anonymous}::LocalScope::const_iterator::distance({anonymous}::LocalScope::const_iterator):
Assertion `F != const_iterator() && "L iterator is not reachable from F iterator."' failed. Backtrace: 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 -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -Wuninitialized -fms-compatibility <source>
1. <eof> parser at end of file
2. <source>:3:10: parsing function body 'f'
#0 0x0000555f7340d8cf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c108cf)
#1 0x0000555f7340b63c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c0e63c)
#2 0x0000555f73354cb8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f5ed55ac420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007f5ed507900b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007f5ed5058859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007f5ed5058729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007f5ed5069fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x0000555f768ab154 (anonymous namespace)::CFGBuilder::addAutomaticObjHandling((anonymous namespace)::LocalScope::const_iterator, (anonymous namespace)::LocalScope::const_iterator, clang::Stmt*) (.isra.0) CFG.cpp:0:0
#9 0x0000555f768ac63c (anonymous namespace)::CFGBuilder::VisitGotoStmt(clang::GotoStmt*) CFG.cpp:0:0
#10 0x0000555f768b542d (anonymous namespace)::CFGBuilder::VisitCompoundStmt(clang::CompoundStmt*, bool) CFG.cpp:0:0
#11 0x0000555f768b736c (anonymous namespace)::CFGBuilder::buildCFG(clang::Decl const*, clang::Stmt*) CFG.cpp:0:0
#12 0x0000555f768b8b57 clang::CFG::buildCFG(clang::Decl const*, clang::Stmt*, clang::ASTContext*, clang::CFG::BuildOptions const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x70bbb57)
#13 0x0000555f7685c5b0 clang::AnalysisDeclContext::getCFG() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x705f5b0)
#14 0x0000555f767b843b clang::sema::AnalysisBasedWarnings::IssueWarnings(clang::sema::AnalysisBasedWarnings::Policy, clang::sema::FunctionScopeInfo*, clang::Decl const*, clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6fbb43b)
#15 0x0000555f75cbfcc6 clang::Sema::PopFunctionScopeInfo(clang::sema::AnalysisBasedWarnings::Policy const*, clang::Decl const*, clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64c2cc6)
#16 0x0000555f75ebf3bc clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66c23bc)
#17 0x0000555f75c3c75d clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x643f75d)
#18 0x0000555f75b67491 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x636a491)
#19 0x0000555f75b8e360 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6391360)
#20 0x0000555f75b5ad31 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x635dd31)
#21 0x0000555f75b5b5ef clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#22 0x0000555f75b61f91 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6364f91)
#23 0x0000555f75b62906 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6365906)
#24 0x0000555f75b566ca clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63596ca)
#25 0x0000555f7465a738 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4e5d738)
#26 0x0000555f73eb28d9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x46b58d9)
#27 0x0000555f73e36da6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4639da6)
#28 0x0000555f73f95476 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4798476)
#29 0x0000555f708cb11d cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x10ce11d)
#30 0x0000555f708c6e1a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#31 0x0000555f73c9ed6d 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
#32 0x0000555f733551c0 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b581c0)
#33 0x0000555f73c9f38f 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
#34 0x0000555f73c66abc clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4469abc)
#35 0x0000555f73c6754d 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+++0x446a54d)
#36 0x0000555f73c6f62d clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x447262d)
#37 0x0000555f708c937a clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x10cc37a)
#38 0x0000555f707d01f5 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xfd31f5)
#39 0x00007f5ed505a083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#40 0x0000555f708c1bfe _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x10c4bfe)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134 |
@llvm/issue-subscribers-clang-frontend |
This was fixed |
Extended Description
This testcase:
... crashes when built with clang++ -Wuninitialized -fms-compatibility:
The text was updated successfully, but these errors were encountered: