Closed ZhangZhuoSJTU closed 3 years ago
Confirmed, crashes here:
==10160== Invalid read of size 2
==10160== at 0x83641F2: getDeclKind (DeclBase.h:1810)
==10160== by 0x83641F2: isObjCContainer (DeclBase.h:1856)
==10160== by 0x83641F2: clang::Sema::ActOnTagFinishDefinition(clang::Scope*, clang::Decl*, clang::SourceRange) (SemaDecl.cpp:16234)
==10160== by 0x79A35A0: clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int, clang::Decl*) (ParseDeclCXX.cpp:3402)
==10160== by 0x79A01E9: clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::Parser::ParsedAttributesWithRange&) (ParseDeclCXX.cpp:1962)
==10160== by 0x797B9BD: clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) (ParseDecl.cpp:3834)
==10160== by 0x797B1E6: clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, bool, clang::Parser::ForRangeInit*, clang::SourceLocation*) (ParseDecl.cpp:1671)
==10160== by 0x797AACD: clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, clang::SourceLocation*) (ParseDecl.cpp:1633)
==10160== by 0x7A1045A: clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) (ParseStmt.cpp:222)
==10160== by 0x7A0FEC2: clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (ParseStmt.cpp:106)
==10160== by 0x7A197F2: clang::Parser::ParseCompoundStatementBody(bool) (ParseStmt.cpp:1089)
==10160== by 0x7A1AB7F: clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (ParseStmt.cpp:2237)
==10160== by 0x7A3719E: clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (Parser.cpp:1339)
==10160== by 0x798278D: clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) (ParseDecl.cpp:1924)
==10160== Address 0x8 is not stack'd, malloc'd or (recently) free'd
Similar to issue #226. This crash also came from clang's parsing routines.
$ clang -c test.cc
test.cc:6:13: error: 'auto' not allowed in non-static union member
...
clang: /backup/work/compilers/compiler-source/llvm-project/clang/lib/Sema/SemaDecl.cpp:1286: void clang::Sema::PushDeclContext(clang::Scope *, clang::DeclContext *): Assertion `DC->getLexicalParent() == C
urContext && "The next DeclContext should be lexically contained in the current one."' failed.
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: /backup/work/compilers/compiler-install/llvm-12.0.0-dev/bin/clang -c test.cc
1. <eof> parser at end of file
2. test.cc:1:12: parsing function body 'main'
3. test.cc:1:12: in compound statement ('{}')
4. test.cc:2:3: parsing struct/union/class body ''
#0 0x0000000002f7987a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /backup/work/compilers/compiler-source/llvm-project/llvm/lib/Support/Unix/Signals.inc:563:11
#1 0x0000000002f79a4b PrintStackTraceSignalHandler(void*) /backup/work/compilers/compiler-source/llvm-project/llvm/lib/Support/Unix/Signals.inc:630:1
#2 0x0000000002f7803b llvm::sys::RunSignalHandlers() /backup/work/compilers/compiler-source/llvm-project/llvm/lib/Support/Signals.cpp:70:5
#3 0x0000000002f7916e llvm::sys::CleanupOnSignal(unsigned long) /backup/work/compilers/compiler-source/llvm-project/llvm/lib/Support/Unix/Signals.inc:362:1
#4 0x0000000002eb3618 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) /backup/work/compilers/compiler-source/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:75:20
#5 0x0000000002eb38f3 CrashRecoverySignalHandler(int) /backup/work/compilers/compiler-source/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:389:1
#6 0x00007f91245d0890 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#7 0x00007f9123022e97 raise /build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#8 0x00007f9123024801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
#9 0x00007f912301439a __assert_fail_base /build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
#10 0x00007f9123014412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
#11 0x0000000006b19229 clang::Sema::PushDeclContext(clang::Scope*, clang::DeclContext*) /backup/work/compilers/compiler-source/llvm-project/clang/lib/Sema/SemaDecl.cpp:1287:16
Closing it as not a creduce issue. Thanks.
test.cc:
PASS_BUG_INFO.TXT: