[llvm-bugs] [Bug 25949] New: Assertion `getKind() == Pack` in function pack_size

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Dec 27 08:39:45 PST 2015


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

            Bug ID: 25949
           Summary: Assertion `getKind() == Pack` in function pack_size
           Product: clang
           Version: 3.6
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: pkryger at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

I use self compiled Homebrew version of clang (compiled on Mac Os X El Captain
10.11.2 (15C50) with Apple LLVM version 7.0.2 (clang-700.1.81):
$ brew info llvm
llvm: stable 3.6.2 (bottled), HEAD [keg-only]
Next-gen compiler infrastructure
http://llvm.org/
/usr/local/Cellar/llvm/3.6.2 (1486 files, 449M)
  Built from source with: --with-clang
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/llvm.rb

When I use the Homebrew version to compile the following code:
----- code begin -----
#include <functional>
#include <utility>

template <typename T>
struct Foo {
    T t;
    template <typename ...TArgs>
    using TMem = void(T::*)(TArgs...);
    template <typename ...TArgs, typename ...FArgs>
    void foo(TMem<TArgs...>&& tmem, FArgs&& ...fargs) {
        auto f = std::bind(std::forward<TMem<TArgs...>>(tmem),
                           &t,
                           std::forward<FArgs...>(fargs)...);
        f();
    }
};

struct Bar {
    void bar(bool) {}
};

int main(const int argc, const char** argv) {
    Foo<Bar> f;
    f.foo(&Bar::bar, true);
    return 0;
}
----- code end -----

I get the following diagnostic:
[ 84%] Building CXX object src/CMakeFiles/proactor-test.dir/foobar.t.cpp.o
Assertion failed: (getKind() == Pack), function pack_size, file
/tmp/llvm20151121-54717-1w1j8v5/llvm-3.6.2.src/tools/clang/include/clang/AST/TemplateBase.h,
line 338.
0  clang-3.6                0x00000001044ff999
llvm::sys::PrintStackTrace(__sFILE*) + 57
1  clang-3.6                0x00000001044ffef6 SignalHandler(int) + 218
2  libsystem_platform.dylib 0x00007fff8a9f6eaa _sigtramp + 26
3  clang-3.6                0x0000000105c0fbac guard variable for
isAllowedInitiallyIDChar(unsigned int, clang::LangOptions
const&)::C99DisallowedInitialIDChars + 85140
4  clang-3.6                0x00000001044ffd84 abort + 22
5  clang-3.6                0x00000001044ffd6e abort + 0
6  clang-3.6                0x0000000104fc5319
getDepthAndIndex(clang::NamedDecl*) + 0
7  clang-3.6                0x0000000104fa4f96 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformTemplateSpecializationType(clang::TypeLocBuilder&,
clang::TemplateSpecializationTypeLoc, clang::TemplateName) + 766
8  clang-3.6                0x0000000104f8fdd9 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
clang::TypeLoc) + 6833
9  clang-3.6                0x0000000104fa96b8 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformReferenceType(clang::TypeLocBuilder&,
clang::ReferenceTypeLoc) + 88
10 clang-3.6                0x0000000104f8e5a5 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
clang::TypeLoc) + 637
11 clang-3.6                0x0000000104f8e0c9 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformType(clang::TypeSourceInfo*) + 195
12 clang-3.6                0x0000000104f8df98
clang::Sema::SubstType(clang::TypeSourceInfo*,
clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation,
clang::DeclarationName) + 100
13 clang-3.6                0x0000000104f92645
clang::Sema::SubstParmVarDecl(clang::ParmVarDecl*,
clang::MultiLevelTemplateArgumentList const&, int, llvm::Optional<unsigned
int>, bool) + 331
14 clang-3.6                0x0000000104faa488 (anonymous
namespace)::TemplateInstantiator::TransformFunctionTypeParam(clang::ParmVarDecl*,
int, llvm::Optional<unsigned int>, bool) + 72
15 clang-3.6                0x0000000104f92e2a clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformFunctionTypeParams(clang::SourceLocation,
clang::ParmVarDecl**, unsigned int, clang::QualType const*,
llvm::SmallVectorImpl<clang::QualType>&,
llvm::SmallVectorImpl<clang::ParmVarDecl*>*) + 710
16 clang-3.6                0x0000000104f91a91
clang::Sema::SubstFunctionDeclType(clang::TypeSourceInfo*,
clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation,
clang::DeclarationName, clang::CXXRecordDecl*, unsigned int) + 1021
17 clang-3.6                0x0000000104fbb10e
clang::TemplateDeclInstantiator::SubstFunctionType(clang::FunctionDecl*,
llvm::SmallVectorImpl<clang::ParmVarDecl*>&) + 256
18 clang-3.6                0x0000000104fb942b
clang::TemplateDeclInstantiator::VisitCXXMethodDecl(clang::CXXMethodDecl*,
clang::TemplateParameterList*, bool) + 843
19 clang-3.6                0x0000000104fbba26
clang::Sema::SubstDecl(clang::Decl*, clang::DeclContext*,
clang::MultiLevelTemplateArgumentList const&) + 156
20 clang-3.6                0x0000000104f667e2
clang::Sema::FinishTemplateArgumentDeduction(clang::FunctionTemplateDecl*,
llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int,
clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&,
llvm::SmallVectorImpl<clang::Sema::OriginalCallArg> const*) + 1580
21 clang-3.6                0x0000000104f67e78
clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*,
clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>,
clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&) + 2126
22 clang-3.6                0x0000000104ee68b0
clang::Sema::AddMethodTemplateCandidate(clang::FunctionTemplateDecl*,
clang::DeclAccessPair, clang::CXXRecordDecl*, clang::TemplateArgumentListInfo*,
clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>,
clang::OverloadCandidateSet&, bool) + 348
23 clang-3.6                0x0000000104ef5902
clang::Sema::BuildCallToMemberFunction(clang::Scope*, clang::Expr*,
clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation) + 1466
24 clang-3.6                0x0000000104de65e6
clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation,
llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool)
+ 1912
25 clang-3.6                0x0000000104bc7fad
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) + 3561
26 clang-3.6                0x0000000104bc9d28
clang::Parser::ParseCastExpression(bool, bool, bool&,
clang::Parser::TypeCastState) + 6948
27 clang-3.6                0x0000000104bc7139
clang::Parser::ParseCastExpression(bool, bool, clang::Parser::TypeCastState) +
35
28 clang-3.6                0x0000000104bc6549
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 117
29 clang-3.6                0x0000000104bc64be
clang::Parser::ParseExpression(clang::Parser::TypeCastState) + 14
30 clang-3.6                0x0000000104bedb7d
clang::Parser::ParseExprStatement() + 39
31 clang-3.6                0x0000000104bed6bf
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 2223
32 clang-3.6                0x0000000104becd6f
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 121
33 clang-3.6                0x0000000104bf14ce
clang::Parser::ParseCompoundStatementBody(bool) + 1330
34 clang-3.6                0x0000000104bf1aa6
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 194
35 clang-3.6                0x0000000104bff75a
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) +
2130
36 clang-3.6                0x0000000104bae471
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1301
37 clang-3.6                0x0000000104bfee64
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 624
38 clang-3.6                0x0000000104bfea52
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 306
39 clang-3.6                0x0000000104bfe2cd
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 1993
40 clang-3.6                0x0000000104bfdab3
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 349
41 clang-3.6                0x0000000104ba1e16 clang::ParseAST(clang::Sema&,
bool, bool) + 335
42 clang-3.6                0x0000000104691e93 clang::FrontendAction::Execute()
+ 67
43 clang-3.6                0x000000010466f91a
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 556
44 clang-3.6                0x00000001046bd73a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2942
45 clang-3.6                0x0000000103a11830 cc1_main(llvm::ArrayRef<char
const*>, char const*, void*) + 922
46 clang-3.6                0x0000000103a10db5 main + 8166
47 libdyld.dylib            0x00007fff99fd85ad start + 1
48 libdyld.dylib            0x000000000000003f start + 1711438483
Stack dump:
0.      Program arguments: /usr/local/Cellar/llvm/3.6.2/bin/clang-3.6 -cc1
-triple x86_64-apple-macosx10.11.0 -emit-obj -mrelax-all -disable-free
-main-file-name foobar.t.cpp -mrelocation-model pic -pic-level 2 -mthread-model
posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2
-target-linker-version 253.6 -dwarf-column-info -coverage-file
/Users/pkryger/proactor/bld/src/CMakeFiles/proactor-test.dir/foobar.t.cpp.o
-resource-dir /usr/local/Cellar/llvm/3.6.2/bin/../lib/clang/3.6.2 -isystem
/Users/pkryger/proactor/googletest/googletest/include -isystem
/Users/pkryger/proactor/googletest/googlemock/include -isystem
/usr/local/include -D GTEST_USE_OWN_TR1_TUPLE=1 -stdlib=libc++ -Wall -Wextra
-Werror -std=gnu++14 -fdeprecated-macro -fdebug-compilation-dir
/Users/pkryger/proactor/bld/src -ferror-limit 19 -fmessage-length 100
-stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.11.0
-fencode-extended-block-signature -fcxx-exceptions -fexceptions
-fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o
CMakeFiles/proactor-test.dir/foobar.t.cpp.o -x c++
/Users/pkryger/proactor/src/foobar.t.cpp
1.      /Users/pkryger/proactor/src/foobar.t.cpp:24:26: current parser token
')'
2.      /Users/pkryger/proactor/src/foobar.t.cpp:22:45: parsing function body
'main'
3.      /Users/pkryger/proactor/src/foobar.t.cpp:22:45: in compound statement
('{}')
clang-3.6: error: unable to execute command: Illegal instruction: 4
clang-3.6: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.6.2 (tags/RELEASE_362/final)
Target: x86_64-apple-darwin15.2.0
Thread model: posix
clang-3.6: 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.6: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.6: note: diagnostic msg:
/var/folders/hg/59f2qp314rgf0z3ttpzpm8bm0000gn/T/foobar-61b3ff.cpp
clang-3.6: note: diagnostic msg:
/var/folders/hg/59f2qp314rgf0z3ttpzpm8bm0000gn/T/foobar-61b3ff.sh
clang-3.6: note: diagnostic msg:

********************
make[2]: *** [src/CMakeFiles/proactor-test.dir/foobar.t.cpp.o] Error 254
make[1]: *** [src/CMakeFiles/proactor-test.dir/all] Error 2
make: *** [all] Error 2


The code works fine with g++-5 (Homebrew gcc 5.2.0 --without-multilib) 5.2.0
and pple LLVM version 7.0.2 (clang-700.1.81)

-- 
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/20151227/4a817f13/attachment-0001.html>


More information about the llvm-bugs mailing list