[llvm-bugs] [Bug 28862] New: crash on invalid c++ code on x86_64-linux-gnu (Assertion `(Cand->FailureKind == ovl_fail_too_many_arguments) || (Cand->FailureKind == ovl_fail_bad_deduction && Cand->DeductionFailure.Result == Sema::TDK_TooManyArguments)' failed)

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 5 00:40:56 PDT 2016


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

            Bug ID: 28862
           Summary: crash on invalid c++ code on x86_64-linux-gnu
                    (Assertion `(Cand->FailureKind ==
                    ovl_fail_too_many_arguments) || (Cand->FailureKind ==
                    ovl_fail_bad_deduction &&
                    Cand->DeductionFailure.Result ==
                    Sema::TDK_TooManyArguments)' failed)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chengniansun at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

$ clang++-trunk -v
clang version 4.0.0 (trunk 277732)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.1.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.1.1
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.1.1
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang++-trunk small.C
small.C:1:40: warning: variadic templates are a C++11 extension
[-Wc++11-extensions]
template < template < typename > class ... >struct B
                                       ^
small.C:7:3: error: no matching function for call to 'foo'
  foo (B <> ());
  ^~~
clang-4.0:
/tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/Sema/SemaOverload.cpp:9316:
bool CheckArityMismatch(clang::Sema&, clang::OverloadCandidate*, unsigned int):
Assertion `(Cand->FailureKind == ovl_fail_too_many_arguments) ||
(Cand->FailureKind == ovl_fail_bad_deduction && Cand->DeductionFailure.Result
== Sema::TDK_TooManyArguments)' failed.
#0 0x0000000001b7d425 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1b7d425)
#1 0x0000000001b7b14e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-4.0+0x1b7b14e)
#2 0x0000000001b7b2b2 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-4.0+0x1b7b2b2)
#3 0x00007feb6f133ed0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10ed0)
#4 0x00007feb6dcc81c8 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x331c8)
#5 0x00007feb6dcc964a abort (/lib/x86_64-linux-gnu/libc.so.6+0x3464a)
#6 0x00007feb6dcc1107 (/lib/x86_64-linux-gnu/libc.so.6+0x2c107)
#7 0x00007feb6dcc11b2 (/lib/x86_64-linux-gnu/libc.so.6+0x2c1b2)
#8 0x0000000002aa7f99 CheckArityMismatch(clang::Sema&,
clang::OverloadCandidate*, unsigned int) [clone .isra.103]
(/usr/local/clang-trunk/bin/clang-4.0+0x2aa7f99)
#9 0x0000000002ac9e8e clang::OverloadCandidateSet::NoteCandidates(clang::Sema&,
clang::OverloadCandidateDisplayKind, llvm::ArrayRef<clang::Expr*>,
llvm::StringRef, clang::SourceLocation)
(/usr/local/clang-trunk/bin/clang-4.0+0x2ac9e8e)
#10 0x0000000002ad712e FinishOverloadedCallExpr(clang::Sema&, clang::Scope*,
clang::Expr*, clang::UnresolvedLookupExpr*, clang::SourceLocation,
llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*,
clang::OverloadCandidateSet*, clang::OverloadCandidate**,
clang::OverloadingResult, bool) [clone .constprop.786]
(/usr/local/clang-trunk/bin/clang-4.0+0x2ad712e)
#11 0x0000000002ad789d clang::Sema::BuildOverloadedCallExpr(clang::Scope*,
clang::Expr*, clang::UnresolvedLookupExpr*, clang::SourceLocation,
llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool,
bool) (/usr/local/clang-trunk/bin/clang-4.0+0x2ad789d)
#12 0x0000000002978763 clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*,
clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation, clang::Expr*, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2978763)
#13 0x000000000263678b
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) (/usr/local/clang-trunk/bin/clang-4.0+0x263678b)
#14 0x0000000002631508 clang::Parser::ParseCastExpression(bool, bool, bool&,
clang::Parser::TypeCastState) (/usr/local/clang-trunk/bin/clang-4.0+0x2631508)
#15 0x0000000002633a2d clang::Parser::ParseCastExpression(bool, bool,
clang::Parser::TypeCastState) (/usr/local/clang-trunk/bin/clang-4.0+0x2633a2d)
#16 0x0000000002633ab9
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/usr/local/clang-trunk/bin/clang-4.0+0x2633ab9)
#17 0x0000000002633b39
clang::Parser::ParseExpression(clang::Parser::TypeCastState)
(/usr/local/clang-trunk/bin/clang-4.0+0x2633b39)
#18 0x000000000266f536 clang::Parser::ParseExprStatement()
(/usr/local/clang-trunk/bin/clang-4.0+0x266f536)
#19 0x000000000266e44f
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/usr/local/clang-trunk/bin/clang-4.0+0x266e44f)
#20 0x000000000266e65e
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*)
(/usr/local/clang-trunk/bin/clang-4.0+0x266e65e)
#21 0x0000000002671ac7 clang::Parser::ParseCompoundStatementBody(bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2671ac7)
#22 0x0000000002673e09 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/usr/local/clang-trunk/bin/clang-4.0+0x2673e09)
#23 0x00000000025f90a8
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/usr/local/clang-trunk/bin/clang-4.0+0x25f90a8)
#24 0x0000000002681071
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2681071)
#25 0x0000000002682465
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2682465)
#26 0x0000000002682661
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2682661)
#27 0x0000000002619ac7 clang::Parser::ParseDeclaration(unsigned int,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&)
(/usr/local/clang-trunk/bin/clang-4.0+0x2619ac7)
#28 0x00000000025fac31
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/local/clang-trunk/bin/clang-4.0+0x25fac31)
#29 0x00000000025fb549
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x25fb549)
#30 0x00000000025f0d0b clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x25f0d0b)
#31 0x00000000022d9667 clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-4.0+0x22d9667)
#32 0x0000000001fff7a6 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-4.0+0x1fff7a6)
#33 0x0000000001fd3836
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1fd3836)
#34 0x0000000002083f47
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2083f47)
#35 0x0000000000941778 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-4.0+0x941778)
#36 0x00000000008deb60 main (/usr/local/clang-trunk/bin/clang-4.0+0x8deb60)
#37 0x00007feb6dcb5730 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x20730)
#38 0x000000000093dff9 _start (/usr/local/clang-trunk/bin/clang-4.0+0x93dff9)
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang-4.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
small.C -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb
-resource-dir /usr/local/clang-trunk/bin/../lib/clang/4.0.0 -c-isystem .
-c-isystem /usr/local/include/csmith -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.1.1/../../../../include/c++/6.1.1
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.1.1/../../../../include/x86_64-linux-gnu/c++/6.1.1
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.1.1/../../../../include/x86_64-linux-gnu/c++/6.1.1
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.1.1/../../../../include/c++/6.1.1/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/4.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/cnsun/workspace/meta-compiler/error-fuzzer/exp-runs/crash/RandomTokenManipulationFuzzingEngine/20160804-clang++-trunk--O3-c-Weverything-std=c++14-build-234530
-ferror-limit 19 -fmessage-length 135 -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/small-9225f8.o -x c++ small.C
1.    small.C:7:15: current parser token ')'
2.    small.C:6:1: parsing function body 'foo'
3.    small.C:6:1: in compound statement ('{}')
clang-4.0: error: unable to execute command: Aborted
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 277732)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-4.0: 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-4.0: note: diagnostic msg:
********************

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

********************
$
$ cat small.C
template < template < typename > class ... >struct B
{
};
template < template < typename > class T > void
foo (B < T >)
{
  foo (B <> ());
};

-- 
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/20160805/8b83f4cb/attachment.html>


More information about the llvm-bugs mailing list