[LLVMbugs] [Bug 15023] New: Clang crashes when variadic argument pack contains reference and value types.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jan 21 12:03:13 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=15023

             Bug #: 15023
           Summary: Clang crashes when variadic argument pack contains
                    reference and value types.
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: peter.goodman at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9902
  --> http://llvm.org/bugs/attachment.cgi?id=9902
Minimal test case (C++ file).

Clang crashes when both value types and reference types are used in an inferred
argument pack, and when that argument type pack is used as the argument types
to a function pointer.

Stack trace:
pag at sloth:~/Code$ clang++ ./test.cc
./test.cc:2:19: warning: variadic templates are a C++11 extension
      [-Wc++11-extensions]
template <typename... Args>
                  ^
./test.cc:11:5: error: no matching function for call to 'func'
    func(bar, 1, two)
    ^~~~
clang: /home/pag/Code/llvm/tools/clang/lib/Basic/Diagnostic.cpp:744: void
clang::Diagnostic::FormatDiagnostic(const char*, const char*,
llvm::SmallVectorImpl<char>&) const: Assertion `ModifierLen == 0 && "No
modifiers for strings yet"' failed.
0  clang           0x0000000001d44ba2 llvm::sys::PrintStackTrace(_IO_FILE*) +
34
1  clang           0x0000000001d447f9
2  libpthread.so.0 0x00007fea39384cb0
3  libc.so.6       0x00007fea385d3425 gsignal + 53
4  libc.so.6       0x00007fea385d6b8b abort + 379
5  libc.so.6       0x00007fea385cc0ee
6  libc.so.6       0x00007fea385cc192
7  clang           0x00000000012aa7a4
8  clang           0x0000000000780077
clang::TextDiagnosticPrinter::HandleDiagnostic(clang::DiagnosticsEngine::Level,
clang::Diagnostic const&) + 87
9  clang           0x00000000012b0324
clang::DiagnosticIDs::EmitDiag(clang::DiagnosticsEngine&,
clang::DiagnosticIDs::Level) const + 52
10 clang           0x00000000012b05a5
clang::DiagnosticIDs::ProcessDiag(clang::DiagnosticsEngine&) const + 341
11 clang           0x00000000012a9064
clang::DiagnosticsEngine::EmitCurrentDiagnostic(bool) + 36
12 clang           0x0000000000a99e07
clang::Sema::EmitCurrentDiagnostic(unsigned int) + 679
13 clang           0x0000000000aa1adf
14 clang           0x0000000000c7c9bb
clang::OverloadCandidateSet::NoteCandidates(clang::Sema&,
clang::OverloadCandidateDisplayKind, llvm::ArrayRef<clang::Expr*>,
llvm::StringRef, clang::SourceLocation) + 4907
15 clang           0x0000000000c7d7bd
16 clang           0x0000000000c7e089
clang::Sema::BuildOverloadedCallExpr(clang::Scope*, clang::Expr*,
clang::UnresolvedLookupExpr*, clang::SourceLocation, clang::Expr**, unsigned
int, clang::SourceLocation, clang::Expr*, bool) + 537
17 clang           0x0000000000bdbfe0 clang::Sema::ActOnCallExpr(clang::Scope*,
clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation, clang::Expr*, bool) + 848
18 clang           0x0000000000a461b0
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) + 4096
19 clang           0x0000000000a3f3a3 clang::Parser::ParseCastExpression(bool,
bool, bool&, clang::Parser::TypeCastState) + 243
20 clang           0x0000000000a4169d clang::Parser::ParseCastExpression(bool,
bool, clang::Parser::TypeCastState) + 29
21 clang           0x0000000000a42a7f
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 31
22 clang           0x0000000000a43b29
clang::Parser::ParseExpression(clang::Parser::TypeCastState) + 9
23 clang           0x0000000000a72c60 clang::Parser::ParseExprStatement() + 48
24 clang           0x0000000000a6ff8f
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 2127
25 clang           0x0000000000a7010d
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 141
26 clang           0x0000000000a6d977
clang::Parser::ParseCompoundStatementBody(bool) + 1863
27 clang           0x0000000000a7436d
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 141
28 clang           0x0000000000a18799
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) +
1097
29 clang           0x0000000000a28d24
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1188
30 clang           0x0000000000a12eb8
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 248
31 clang           0x0000000000a131b2
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 130
32 clang           0x0000000000a157fd
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 125
33 clang           0x0000000000a15e13
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 195
34 clang           0x0000000000a114bb clang::ParseAST(clang::Sema&, bool, bool)
+ 267
35 clang           0x00000000008c2d91 clang::CodeGenAction::ExecuteAction() +
97
36 clang           0x000000000075bf46 clang::FrontendAction::Execute() + 150
37 clang           0x000000000073f22d
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 349
38 clang           0x00000000007269a2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1442
39 clang           0x00000000007200b8 cc1_main(char const**, char const**, char
const*, void*) + 984
40 clang           0x0000000000714b78 main + 4936
41 libc.so.6       0x00007fea385be76d __libc_start_main + 237
42 clang           0x000000000071f079
Stack dump:
0.    Program arguments: /usr/local/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
test.cc -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-target-linker-version 2.22.90.20120924 -momit-leaf-frame-pointer -resource-dir
/usr/local/bin/../lib/clang/3.3 -fmodule-cache-path /var/tmp/clang-module-cache
-internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/x86_64-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/bin/../lib/clang/3.3/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/pag/Code -ferror-limit 19 -fmessage-length 80
-mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -backend-option -vectorize-loops
-o /tmp/test-siRQEu.o -x c++ ./test.cc 
1.    ./test.cc:11:21: current parser token ')'
2.    ./test.cc:9:16: parsing function body 'main'
3.    ./test.cc:9:16: in compound statement ('{}')
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.3 (trunk 172567) (llvm/trunk 172566)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang: 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: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/test-xbJhDw.cpp
clang: note: diagnostic msg: /tmp/test-xbJhDw.sh
clang: note: diagnostic msg: 

********************

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list