Closed aytey closed 3 years ago
Oh, wow, actually, this crashes clang
:
avj@vistrrdslin0001 ~/clones/creduce/llvm-11.0/clang_delta/ex$ g++-11 -c 54.cpp
avj@vistrrdslin0001 ~/clones/creduce/llvm-11.0/clang_delta/ex$ clang++-12 -c 54.cpp
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clang++-12 -c 54.cpp
1. 54.cpp:7:12: current parser token ';'
2. 54.cpp:3:1: parsing namespace '(anonymous)'
3. 54.cpp:4:21: parsing function body '(anonymous namespace)::bx'
4. 54.cpp:4:21: in compound statement ('{}')
#0 0x00007f43f67c6c31 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/bin/../lib64/libLLVM.so.12+0x290bc31)
#1 0x00007f43f67c44e0 llvm::sys::RunSignalHandlers() (/usr/bin/../lib64/libLLVM.so.12+0x29094e0)
#2 0x00007f43f67c5f6b llvm::sys::CleanupOnSignal(unsigned long) (/usr/bin/../lib64/libLLVM.so.12+0x290af6b)
#3 0x00007f43f66e04c9 (/usr/bin/../lib64/libLLVM.so.12+0x28254c9)
#4 0x00007f43f3b103a0 __restore_rt (/usr/bin/../lib64/libc.so.6+0x3d3a0)
#5 0x00007f43fb99c1dc (/usr/bin/../lib64/libclang-cpp.so.12+0x1d061dc)
#6 0x00007f43fb99b3b4 clang::Sema::PerformMoveOrCopyInitialization(clang::InitializedEntity const&, clang::VarDecl const*, clang::QualType, clang::Expr*, bool) (/usr/bin/../lib64/libclang-cpp.so.12+0x1d053b4)
#7 0x00007f43fb99f45c clang::Sema::BuildReturnStmt(clang::SourceLocation, clang::Expr*) (/usr/bin/../lib64/libclang-cpp.so.12+0x1d0945c)
#8 0x00007f43fb99e699 clang::Sema::ActOnReturnStmt(clang::SourceLocation, clang::Expr*, clang::Scope*) (/usr/bin/../lib64/libclang-cpp.so.12+0x1d08699)
#9 0x00007f43fabe5216 clang::Parser::ParseReturnStatement() (/usr/bin/../lib64/libclang-cpp.so.12+0xf4f216)
#10 0x00007f43fabddd7b clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) (/usr/bin/../lib64/libclang-cpp.so.12+0xf47d7b)
#11 0x00007f43fabdd138 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/bin/../lib64/libclang-cpp.so.12+0xf47138)
#12 0x00007f43fabe7743 clang::Parser::ParseCompoundStatementBody(bool) (/usr/bin/../lib64/libclang-cpp.so.12+0xf51743)
#13 0x00007f43fabe8ab5 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/usr/bin/../lib64/libclang-cpp.so.12+0xf52ab5)
#14 0x00007f43fac04e64 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/usr/bin/../lib64/libclang-cpp.so.12+0xf6ee64)
#15 0x00007f43fab48a61 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/usr/bin/../lib64/libclang-cpp.so.12+0xeb2a61)
#16 0x00007f43fac03e13 clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/usr/bin/../lib64/libclang-cpp.so.12+0xf6de13)
#17 0x00007f43fac0377d clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/usr/bin/../lib64/libclang-cpp.so.12+0xf6d77d)
#18 0x00007f43fac025c6 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/usr/bin/../lib64/libclang-cpp.so.12+0xf6c5c6)
#19 0x00007f43fab6030b clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/usr/bin/../lib64/libclang-cpp.so.12+0xeca30b)
#20 0x00007f43fab5fdca clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (/usr/bin/../lib64/libclang-cpp.so.12+0xec9dca)
#21 0x00007f43fab411eb clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, clang::SourceLocation*) (/usr/bin/../lib64/libclang-cpp.so.12+0xeab1eb)
#22 0x00007f43fac01add clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/usr/bin/../lib64/libclang-cpp.so.12+0xf6badd)
#23 0x00007f43fac0072d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) (/usr/bin/../lib64/libclang-cpp.so.12+0xf6a72d)
#24 0x00007f43fab2dafd clang::ParseAST(clang::Sema&, bool, bool) (/usr/bin/../lib64/libclang-cpp.so.12+0xe97afd)
#25 0x00007f43fbed83b3 clang::CodeGenAction::ExecuteAction() (/usr/bin/../lib64/libclang-cpp.so.12+0x22423b3)
#26 0x00007f43fc984d74 clang::FrontendAction::Execute() (/usr/bin/../lib64/libclang-cpp.so.12+0x2ceed74)
#27 0x00007f43fc90c00d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/bin/../lib64/libclang-cpp.so.12+0x2c7600d)
#28 0x00007f43fca07fc6 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/bin/../lib64/libclang-cpp.so.12+0x2d71fc6)
#29 0x0000000000213e8b cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang-12.0.0+0x213e8b)
#30 0x000000000021205d (/usr/bin/clang-12.0.0+0x21205d)
#31 0x00007f43fc5776d2 (/usr/bin/../lib64/libclang-cpp.so.12+0x28e16d2)
#32 0x00007f43f66dfe65 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/bin/../lib64/libLLVM.so.12+0x2824e65)
#33 0x00007f43fc576f53 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const (/usr/bin/../lib64/libclang-cpp.so.12+0x28e0f53)
#34 0x00007f43fc549ce3 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/usr/bin/../lib64/libclang-cpp.so.12+0x28b3ce3)
#35 0x00007f43fc54a18a clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
const (/usr/bin/../lib64/libclang-cpp.so.12+0x28b418a)
#36 0x00007f43fc55f81d clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/usr/bin/../lib64/libclang-cpp.so.12+0x28c981d)
#37 0x00000000002118f2 main (/usr/bin/clang-12.0.0+0x2118f2)
#38 0x00007f43f3afab35 __libc_start_main (/usr/bin/../lib64/libc.so.6+0x27b35)
#39 0x000000000020ef3e _start (/usr/bin/clang-12.0.0+0x20ef3e)
clang-12.0: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 12.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-12.0: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-12.0: note: diagnostic msg: /mnt/baranem/54-beb051.cpp
clang-12.0: note: diagnostic msg: /mnt/baranem/54-beb051.sh
clang-12.0: note: diagnostic msg:
********************
Closing!
Reported here: https://bugs.llvm.org/show_bug.cgi?id=51176
Congratulations on finding a clang bug!
As reported in https://github.com/marxin/cvise/issues/54
For:
(that is, I'm using the
llvm-11.0
branch ofcreduce
)with:
and on the following file:
we get:
The crash looks like something: