[LLVMbugs] [Bug 23860] New: SemaDecl.cpp:1072: void clang::Sema::PushDeclContext(clang::Scope*, clang::DeclContext*): Assertion `getContainingDC(DC) == CurContext && "The next DeclContext should be lexically contained in the current one."

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 16 12:46:05 PDT 2015


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

            Bug ID: 23860
           Summary: SemaDecl.cpp:1072: void
                    clang::Sema::PushDeclContext(clang::Scope*,
                    clang::DeclContext*): Assertion `getContainingDC(DC)
                    == CurContext && "The next DeclContext should be
                    lexically contained in the current one."
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrey.vul at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

... related to parsing a template structure containing a template function
whose default argument is an evaluation of a capture-less lambda containing a
structure with a member function.

The same assertion failure occurs on 3.6.
3.5 doesn't ICE but makes the linker unhappy: "/usr/bin/ld:
/usr/lib/debug/usr/lib/powerpc64le-linux-gnu/crt1.o(.debug_info): relocation %d
has invalid symbol index 14" and failure to emit the symbol "main".

### SOURCE: cat t.cpp
template <class> struct A {
    template <class T> int f(T x = []()->int{
                    struct B {
                        int g() {
                            return 0;
                        }
                    } y;
                    if (y.g() != 0)
                        return 1;

                    return 0;
                }())
    {
        return x;
    }
};

int main() {
}

### INVOCATION: clang++ -std=c+11 -v t.cpp
clang version 3.7.0 (trunk 239822)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/powerpc64le-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/powerpc64le-linux-gnu/4.8.2
Found candidate GCC installation: /usr/lib/gcc/powerpc64le-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/powerpc64le-linux-gnu/4.9.1
Selected GCC installation: /usr/lib/gcc/powerpc64le-linux-gnu/4.8
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/home/andrey/clang.trunk/bin/clang-3.7" -cc1 -triple
powerpc64le-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name t.cpp -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-fuse-init-array -target-cpu ppc64le -target-abi elfv2 -v -dwarf-column-info
-resource-dir /home/andrey/clang.trunk/bin/../lib/clang/3.7.0 -internal-isystem
/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../../include/c++/4.8
-internal-isystem
/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../../include/powerpc64le-linux-gnu/c++/4.8
-internal-isystem
/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../../include/powerpc64le-linux-gnu/c++/4.8
-internal-isystem
/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../../include/c++/4.8/backward
-internal-isystem /usr/local/include -internal-isystem
/home/andrey/clang.trunk/bin/../lib/clang/3.7.0/include
-internal-externc-isystem /usr/include/powerpc64le-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-std=c++11 -fdeprecated-macro -fdebug-compilation-dir /tmp -ferror-limit 19
-fmessage-length 0 -mstackrealign -fno-signed-char -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -o /tmp/t-8a2f40.o -x
c++ t.cpp
clang -cc1 version 3.7.0 based upon LLVM 3.7.0svn default target
powerpc64le-unknown-linux-gnu
ignoring nonexistent directory "/include"
ignoring duplicate directory
"/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../../include/powerpc64le-linux-gnu/c++/4.8"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../../include/c++/4.8

/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../../include/powerpc64le-linux-gnu/c++/4.8
 /usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../../include/c++/4.8/backward
 /usr/local/include
 /home/andrey/clang.trunk/bin/../lib/clang/3.7.0/include
 /usr/include/powerpc64le-linux-gnu
 /usr/include
End of search list.
clang-3.7: /scratch/andreyv/llvm/tools/clang/lib/Sema/SemaDecl.cpp:1072: void
clang::Sema::PushDeclContext(clang::Scope*, clang::DeclContext*): Assertion
`getContainingDC(DC) == CurContext && "The next DeclContext should be lexically
contained in the current one."' failed.
#0 0x12c18760 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/scratch/andreyv/llvm/lib/Support/Unix/Signals.inc:437:0
#1 0x12c18b50 PrintStackTraceSignalHandler(void*)
/scratch/andreyv/llvm/lib/Support/Unix/Signals.inc:494:0
#2 0x12c17338 SignalHandler(int)
/scratch/andreyv/llvm/lib/Support/Unix/Signals.inc:211:0
0  clang-3.7 0x0000000012c18760 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
+ 68
1  clang-3.7 0x0000000012c18b50
2  clang-3.7 0x0000000012c17338
3            0x00003fff8bb70478 __kernel_sigtramp_rt64 + 0
4  libc.so.6 0x00003fff8b6b0a88 gsignal + 72
5  libc.so.6 0x00003fff8b6b693c abort + 620
6  libc.so.6 0x00003fff8b6a65b4
7  libc.so.6 0x00003fff8b6a66a4 __assert_fail + 100
8  clang-3.7 0x00000000147d7c4c clang::Sema::PushDeclContext(clang::Scope*,
clang::DeclContext*) + 108
9  clang-3.7 0x000000001488b5e8
clang::Sema::ActOnStartDelayedMemberDeclarations(clang::Scope*, clang::Decl*) +
136
10 clang-3.7 0x000000001449a1c8
clang::Parser::ParseLexedMethodDeclarations(clang::Parser::ParsingClass&) + 372
11 clang-3.7 0x0000000014499e68
clang::Parser::LateParsedClass::ParseLexedMethodDeclarations() + 60
12 clang-3.7 0x000000001449a214
clang::Parser::ParseLexedMethodDeclarations(clang::Parser::ParsingClass&) + 448
13 clang-3.7 0x000000001442d9c8
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) + 4228
14 clang-3.7 0x00000000144289a0
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&) + 8948
15 clang-3.7 0x0000000014406220
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 10020
16 clang-3.7 0x000000001448c414
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 568
17 clang-3.7 0x000000001448c14c
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 1024
18 clang-3.7 0x000000001448bd0c
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 284
19 clang-3.7 0x00000000143ff528 clang::Parser::ParseDeclaration(unsigned int,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 508
20 clang-3.7 0x00000000143e6c88
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 3028
21 clang-3.7 0x00000000143e6058
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 808
22 clang-3.7 0x00000000143e1488 clang::ParseAST(clang::Sema&, bool, bool) + 432
23 clang-3.7 0x0000000012f08b1c clang::ASTFrontendAction::ExecuteAction() + 468
24 clang-3.7 0x000000001340ad90 clang::CodeGenAction::ExecuteAction() + 1400
25 clang-3.7 0x0000000012f0842c clang::FrontendAction::Execute() + 188
26 clang-3.7 0x0000000012ea9e1c
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1044
27 clang-3.7 0x00000000130e3928
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1316
28 clang-3.7 0x0000000010f58e48 cc1_main(llvm::ArrayRef<char const*>, char
const*, void*) + 876
29 clang-3.7 0x0000000010f48ff4
30 clang-3.7 0x0000000010f4955c main + 1040
31 libc.so.6 0x00003fff8b694d00
32 libc.so.6 0x00003fff8b694ef8 __libc_start_main + 200
Stack dump:
0.    Program arguments: /home/andrey/clang.trunk/bin/clang-3.7 -cc1 -triple
powerpc64le-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name t.cpp -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-fuse-init-array -target-cpu ppc64le -target-abi elfv2 -v -dwarf-column-info
-resource-dir /home/andrey/clang.trunk/bin/../lib/clang/3.7.0 -internal-isystem
/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../../include/c++/4.8
-internal-isystem
/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../../include/powerpc64le-linux-gnu/c++/4.8
-internal-isystem
/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../../include/powerpc64le-linux-gnu/c++/4.8
-internal-isystem
/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../../include/c++/4.8/backward
-internal-isystem /usr/local/include -internal-isystem
/home/andrey/clang.trunk/bin/../lib/clang/3.7.0/include
-internal-externc-isystem /usr/include/powerpc64le-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-std=c++11 -fdeprecated-macro -fdebug-compilation-dir /tmp -ferror-limit 19
-fmessage-length 0 -mstackrealign -fno-signed-char -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -o /tmp/t-8a2f40.o -x
c++ t.cpp 
1.    t.cpp:16:2: current parser token ';'
2.    t.cpp:1:18: parsing struct/union/class body 'A'
clang-3.7: error: unable to execute command: Aborted
clang-3.7: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.7.0 (trunk 239822)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
clang-3.7: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.7: note: diagnostic msg: 
********************

-- 
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/20150616/3a2a60b7/attachment.html>


More information about the llvm-bugs mailing list