[llvm-bugs] [Bug 44940] New: Assertion `getContainingDC(DC) == CurContext && "The next DeclContext should be lexically contained in the current one."' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 17 14:22:59 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=44940

            Bug ID: 44940
           Summary: Assertion `getContainingDC(DC) == CurContext && "The
                    next DeclContext should be lexically contained in the
                    current one."' failed.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: changochen1 at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

POC:
---
struct {
        struct {a ( b = (struct {
                                c {) )
                )
---

Run script:
---
# Crash reproducer for clang version 11.0.0
(https://github.com/llvm/llvm-project.git
56b7f595d2b402ff177ca42214325c8fdea10fb0)
# Driver args: "--driver-mode=g++" "-x" "c++" "-o" "tm" "test1.c"
# Original command:  "/data/rxz226/llvm-project/bld/bin/clang-11" "-cc1"
"-triple" "x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-main-file-name" "test1.c" "-mrelocation-model" "static" "-mthread-model"
"posix" "-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math"
"-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-target-cpu"
"x86-64" "-dwarf-column-info" "-fno-split-dwarf-inlining"
"-debugger-tuning=gdb" "-resource-dir"
"/data/rxz226/llvm-project/bld/lib/clang/11.0.0" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/x86_64-linux-gnu/c++/7.4.0"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/x86_64-linux-gnu/c++/7.4.0"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/backward"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/data/rxz226/llvm-project/bld/lib/clang/11.0.0/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-fdeprecated-macro" "-fdebug-compilation-dir"
"/home/rxz226/c_reduce" "-ferror-limit" "19" "-fmessage-length" "0"
"-fgnuc-version=4.2.1" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions"
"-fdiagnostics-show-option" "-fcolor-diagnostics" "-faddrsig" "-o"
"/tmp/test1-0eca8d.o" "-x" "c++" "test1.c"
 "/data/rxz226/llvm-project/bld/bin/clang-11" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-main-file-name" "test1.c" "-mrelocation-model" "static" "-mthread-model"
"posix" "-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math"
"-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-target-cpu"
"x86-64" "-dwarf-column-info" "-fno-split-dwarf-inlining"
"-debugger-tuning=gdb" "-fdeprecated-macro" "-ferror-limit" "19"
"-fmessage-length" "0" "-fgnuc-version=4.2.1" "-fobjc-runtime=gcc"
"-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option"
"-fcolor-diagnostics" "-faddrsig" "-x" "c++" "test1-c8ca1c.cpp"
---


Stack dump:
---
Stack dump:
0.      Program arguments: /home/rxz226/llvm-project/bld/bin/clang++ -x c++ -o
tm test1.c
1.      <eof> parser at end of file
2.      test1.c:1:1: parsing struct/union/class body '(anonymous)'
 #0 0x000000000511679b llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/rxz226/llvm-project/llvm/lib/Support/Unix/Signals.inc:564:0
 #1 0x000000000511682e PrintStackTraceSignalHandler(void*)
/home/rxz226/llvm-project/llvm/lib/Support/Unix/Signals.inc:625:0
 #2 0x00000000051145b6 llvm::sys::RunSignalHandlers()
/home/rxz226/llvm-project/llvm/lib/Support/Signals.cpp:68:0
 #3 0x0000000005115fd7 llvm::sys::CleanupOnSignal(unsigned long)
/home/rxz226/llvm-project/llvm/lib/Support/Unix/Signals.inc:361:0
 #4 0x000000000501be1f (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
/home/rxz226/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:80:0
 #5 0x000000000501c2fe CrashRecoverySignalHandler(int)
/home/rxz226/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:362:0
 #6 0x00007fe6d284d390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
 #7 0x00007fe6d155c428 raise
/build/glibc-LK5gWL/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
 #8 0x00007fe6d155e02a abort /build/glibc-LK5gWL/glibc-2.23/stdlib/abort.c:91:0
 #9 0x00007fe6d1554bd7 __assert_fail_base
/build/glibc-LK5gWL/glibc-2.23/assert/assert.c:92:0
#10 0x00007fe6d1554c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#11 0x0000000007c2f161 clang::Sema::PushDeclContext(clang::Scope*,
clang::DeclContext*)
/home/rxz226/llvm-project/clang/lib/Sema/SemaDecl.cpp:1299:0
#12 0x0000000007d5a8f1
clang::Sema::ActOnStartDelayedMemberDeclarations(clang::Scope*, clang::Decl*)
/home/rxz226/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:9678:0
#13 0x0000000007a0f6a4
clang::Parser::ParseLexedMethodDeclarations(clang::Parser::ParsingClass&)
/home/rxz226/llvm-project/clang/lib/Parse/ParseCXXInlineMethods.cpp:292:0
#14 0x0000000007a0f45d
clang::Parser::LateParsedClass::ParseLexedMethodDeclarations()
/home/rxz226/llvm-project/clang/lib/Parse/ParseCXXInlineMethods.cpp:239:0
#15 0x0000000007a0f6f0
clang::Parser::ParseLexedMethodDeclarations(clang::Parser::ParsingClass&)
/home/rxz226/llvm-project/clang/lib/Parse/ParseCXXInlineMethods.cpp:292:0
#16 0x0000000007a49e11
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) /home/rxz226/llvm-project/clang/lib/Parse/Par
seDeclCXX.cpp:3370:0
#17 0x0000000007a442a1
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, cl
ang::Parser::ParsedAttributesWithRange&)
/home/rxz226/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:1960:0
#18 0x0000000007a258ec
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) /home/rxz22
6/llvm-project/clang/lib/Parse/ParseDecl.cpp:3935:0
#19 0x00000000079ff10d
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:1020:0
#20 0x00000000079ff7ab
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:1125:0
#21 0x00000000079fec86
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:945:0
#22 0x00000000079fdf00
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:696:0
#23 0x00000000079fd881
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:564:0
#24 0x00000000079f97d7 clang::ParseAST(clang::Sema&, bool, bool)
/home/rxz226/llvm-project/clang/lib/Parse/ParseAST.cpp:157:0
#25 0x0000000005c0bed1 clang::ASTFrontendAction::ExecuteAction()
/home/rxz226/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1044:0
#26 0x00000000064f371e clang::CodeGenAction::ExecuteAction()
/home/rxz226/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1177:0
#27 0x0000000005c0b820 clang::FrontendAction::Execute()
/home/rxz226/llvm-project/clang/lib/Frontend/FrontendAction.cpp:940:0
#28 0x0000000005ba0092
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/rxz226/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:965:0
#29 0x0000000005d7818e
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/rxz226/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:290:0
#30 0x000000000272848c cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /home/rxz226/llvm-project/clang/tools/driver/cc1_main.cpp:239:0
#31 0x000000000271d97a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
/home/rxz226/llvm-project/clang/tools/driver/driver.cpp:328:0
...
---

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200217/e401fd38/attachment.html>


More information about the llvm-bugs mailing list