[LLVMbugs] [Bug 22990] New: function template/generic lambda/local class/member function/pack expansion => compiler crash

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Mar 22 16:43:05 PDT 2015


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

            Bug ID: 22990
           Summary: function template/generic lambda/local class/member
                    function/pack expansion => compiler crash
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: alex.cossette at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Attempts to expand parameter pack in a member function in a local class nested
in a generic lambda nested in a function template results in an assertion
failure and compiler crash.

template <class>
void f() {
    [](auto...a) {
        struct C {
            static void g() { f<decltype(a)...>(); }
        };
    }(0);
}

int main() {
    f<void>();
}

Assertion failed: (isa<LabelDecl>(D) && "declaration not instantiated in this
scope"), function findInstantiationOf, file SemaTemplateInstantiate.cpp, line
2802.
0  libLLVM-3.7svn.dylib     0x000000010e1438d5
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 57
1  libLLVM-3.7svn.dylib     0x000000010e143f70 SignalHandler(int) + 217
2  libsystem_platform.dylib 0x00007fff8b1c2f1a _sigtramp + 26
3  libsystem_platform.dylib 0x00007fff61ab0764 _sigtramp + 3599685732
4  libLLVM-3.7svn.dylib     0x000000010e143dff abort + 22
5  libLLVM-3.7svn.dylib     0x000000010e143de9 abort + 0
6  clang                    0x000000010d05f78e clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 61338
7  clang                    0x000000010d089d39
llvm::SmallVectorImpl<clang::Decl*>::operator=(llvm::SmallVectorImpl<clang::Decl*>
const&) + 7755
8  clang                    0x000000010d05fcd3 clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 62687
9  clang                    0x000000010d070a1d clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 131625
10 clang                    0x000000010d074c80 clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 148620
11 clang                    0x000000010d05c77d clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 49033
12 clang                    0x000000010d05b77a clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 44934
13 clang                    0x000000010d067adf clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 94955
14 clang                    0x000000010d05b6de clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 44778
15 clang                    0x000000010d08456b clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 212343
16 clang                    0x000000010d085078 clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 215172
17 clang                    0x000000010d0841c5 clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 211409
18 clang                    0x000000010d085078 clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 215172
19 clang                    0x000000010cda11bf void
std::__1::__merge_move_construct<std::__1::__less<clang::CodeCompletionResult,
clang::CodeCompletionResult>&, clang::CodeCompletionResult*,
clang::CodeCompletionResult*>(clang::CodeCompletionResult*,
clang::CodeCompletionResult*, clang::CodeCompletionResult*,
clang::CodeCompletionResult*,
std::__1::iterator_traits<clang::CodeCompletionResult*>::value_type*,
std::__1::__less<clang::CodeCompletionResult, clang::CodeCompletionResult>&) +
51228
20 clang                    0x000000010cd6977c
llvm::SmallVectorTemplateBase<clang::ParsedTemplateArgument,
false>::grow(unsigned long) + 16958
21 clang                    0x000000010cd0c3a4 void
std::__1::vector<llvm::Type*, std::__1::allocator<llvm::Type*>
>::__push_back_slow_path<llvm::Type* const&>(llvm::Type* const&&&) + 3444
22 clang                    0x000000010ca5c225
std::__1::__tree<std::__1::__value_type<clang::edit::FileOffset,
clang::edit::EditedSource::FileEdit>,
std::__1::__map_value_compare<clang::edit::FileOffset,
std::__1::__value_type<clang::edit::FileOffset,
clang::edit::EditedSource::FileEdit>, std::__1::less<clang::edit::FileOffset>,
true>, std::__1::allocator<std::__1::__value_type<clang::edit::FileOffset,
clang::edit::EditedSource::FileEdit> >
>::destroy(std::__1::__tree_node<std::__1::__value_type<clang::edit::FileOffset,
clang::edit::EditedSource::FileEdit>, void*>*) + 5783
23 clang                    0x000000010ca36c01
std::__1::__vector_base<clang::CompilerInstance*,
std::__1::allocator<clang::CompilerInstance*> >::~__vector_base() + 14605
24 clang                    0x000000010ca093c0
std::__1::__tree<std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > >,
std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> > >
>::__insert_node_at(std::__1::__tree_node_base<void*>*,
std::__1::__tree_node_base<void*>*&, std::__1::__tree_node_base<void*>*) + 3462
25 clang                    0x000000010ca02094
26 clang                    0x000000010ca07dc5
std::__1::__split_buffer<llvm::SourceMgr::SrcBuffer,
std::__1::allocator<llvm::SourceMgr::SrcBuffer>&>::~__split_buffer() + 8165
27 libdyld.dylib            0x00007fff910975c9 start + 1
Stack dump:
0.    Program arguments: /usr/local/Cellar/llvm/HEAD/bin/clang -cc1 -triple
x86_64-apple-macosx10.10.0 -emit-obj -mrelax-all -disable-free -main-file-name
crash.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix
-mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2
-target-linker-version 242 -dwarf-column-info -resource-dir
/usr/local/Cellar/llvm/HEAD/bin/../lib/clang/3.7.0 -stdlib=libc++ -std=c++14
-fdeprecated-macro -fdebug-compilation-dir
/Users/alexk7/Downloads/clang+llvm-3.6.0-x86_64-apple-darwin/bin -ferror-limit
19 -fmessage-length 0 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime=macosx-10.10.0 -fencode-extended-block-signature
-fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -o
/var/folders/9j/5qbhhqtj76v08rf1rggznsrm0000gq/T/crash-3b0f13.o -x c++
/Users/alexk7/Documents/testcpp11/testcpp11/crash.cpp 
1.    <eof> parser at end of file
2.    /Users/alexk7/Documents/testcpp11/testcpp11/crash.cpp:2:6: instantiating
function definition 'f'
3.    /Users/alexk7/Documents/testcpp11/testcpp11/crash.cpp:5:16: instantiating
function definition 'g'
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.7.0  (http://llvm.org/git/llvm.git
00edfaecf079bd80ed9d26f6e97fcdfc936c6937)
Target: x86_64-apple-darwin14.1.0
Thread model: posix

Also tested in 3.5 and 3.6 with same result (without the stack trace).

-- 
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/20150322/641a122c/attachment.html>


More information about the llvm-bugs mailing list