[llvm-bugs] [Bug 30559] New: clang crashes on valid C++11 code: Assertion `ParamIter != FD->param_end()' failed
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Sep 28 21:00:00 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=30559
Bug ID: 30559
Summary: clang crashes on valid C++11 code: Assertion
`ParamIter != FD->param_end()' failed
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: su at cs.ucdavis.edu
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Classification: Unclassified
It affects 3.8.x and later, and is a regression from 3.7.x.
$ clang++ -v
clang version 4.0.0 (trunk 282567)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
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.5
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.3.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/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang++-3.7.0 -c -w -std=c++11 small.cpp
$
$ clang++ -c -w -std=c++11 small.cpp
clang-4.0:
/tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/Sema/SemaChecking.cpp:9083:
void clang::Sema::DiagnoseAlwaysNonNullPointer(clang::Expr*,
clang::Expr::NullPointerConstantKind, bool, clang::SourceRange): Assertion
`ParamIter != FD->param_end()' failed.
#0 0x0000000001e81095 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1e81095)
#1 0x0000000001e7f17e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-4.0+0x1e7f17e)
#2 0x0000000001e7f2e0 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-4.0+0x1e7f2e0)
#3 0x00007f604e823340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007f604d614cc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f604d6180d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f604d60db86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f604d60dc32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x0000000002c6decd clang::Sema::DiagnoseAlwaysNonNullPointer(clang::Expr*,
clang::Expr::NullPointerConstantKind, bool, clang::SourceRange)
(/usr/local/clang-trunk/bin/clang-4.0+0x2c6decd)
#9 0x0000000002dd3a8f
clang::Sema::CheckCompareOperands(clang::ActionResult<clang::Expr*, true>&,
clang::ActionResult<clang::Expr*, true>&, clang::SourceLocation,
clang::BinaryOperatorKind, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2dd3a8f)
#10 0x0000000002de0283 clang::Sema::CreateBuiltinBinOp(clang::SourceLocation,
clang::BinaryOperatorKind, clang::Expr*, clang::Expr*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2de0283)
#11 0x0000000002f635cf
clang::Sema::CreateOverloadedBinOp(clang::SourceLocation,
clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&, clang::Expr*,
clang::Expr*) (/usr/local/clang-trunk/bin/clang-4.0+0x2f635cf)
#12 0x0000000002da84a4 BuildOverloadedBinOp(clang::Sema&, clang::Scope*,
clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2da84a4)
#13 0x0000000002de0cf2 clang::Sema::BuildBinOp(clang::Scope*,
clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2de0cf2)
#14 0x000000000303ad9f clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformBinaryOperator(clang::BinaryOperator*)
(/usr/local/clang-trunk/bin/clang-4.0+0x303ad9f)
#15 0x0000000003038172 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*)
(/usr/local/clang-trunk/bin/clang-4.0+0x3038172)
#16 0x000000000304fdc5 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformTemplateArgument(clang::TemplateArgumentLoc
const&, clang::TemplateArgumentLoc&, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x304fdc5)
#17 0x00000000030537f2 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformTemplateSpecializationType(clang::TypeLocBuilder&,
clang::TemplateSpecializationTypeLoc, clang::TemplateName)
(/usr/local/clang-trunk/bin/clang-4.0+0x30537f2)
#18 0x000000000304a2fd clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformTSIInObjectScope(clang::TypeLoc,
clang::QualType, clang::NamedDecl*, clang::CXXScopeSpec&) [clone .isra.3524]
(/usr/local/clang-trunk/bin/clang-4.0+0x304a2fd)
#19 0x000000000304ac74 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformNestedNameSpecifierLoc(clang::NestedNameSpecifierLoc,
clang::QualType, clang::NamedDecl*)
(/usr/local/clang-trunk/bin/clang-4.0+0x304ac74)
#20 0x00000000030575cf clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformDependentNameType(clang::TypeLocBuilder&,
clang::DependentNameTypeLoc) (/usr/local/clang-trunk/bin/clang-4.0+0x30575cf)
#21 0x0000000003041755 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
clang::TypeLoc) (/usr/local/clang-trunk/bin/clang-4.0+0x3041755)
#22 0x000000000304288a clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformType(clang::TypeSourceInfo*)
(/usr/local/clang-trunk/bin/clang-4.0+0x304288a)
#23 0x00000000030429f2 clang::Sema::SubstType(clang::TypeSourceInfo*,
clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation,
clang::DeclarationName) (/usr/local/clang-trunk/bin/clang-4.0+0x30429f2)
#24 0x000000000305b482 clang::Sema::SubstParmVarDecl(clang::ParmVarDecl*,
clang::MultiLevelTemplateArgumentList const&, int, llvm::Optional<unsigned
int>, bool) (/usr/local/clang-trunk/bin/clang-4.0+0x305b482)
#25 0x000000000305be59 (anonymous
namespace)::TemplateInstantiator::TransformFunctionTypeParam(clang::ParmVarDecl*,
int, llvm::Optional<unsigned int>, bool) [clone .constprop.3538]
(/usr/local/clang-trunk/bin/clang-4.0+0x305be59)
#26 0x000000000305c008 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformFunctionTypeParams(clang::SourceLocation,
llvm::ArrayRef<clang::ParmVarDecl*>, clang::QualType const*,
clang::FunctionProtoType::ExtParameterInfo const*,
llvm::SmallVectorImpl<clang::QualType>&,
llvm::SmallVectorImpl<clang::ParmVarDecl*>*,
clang::Sema::ExtParameterInfoBuilder&)
(/usr/local/clang-trunk/bin/clang-4.0+0x305c008)
#27 0x000000000305d7d6 clang::Sema::SubstParmTypes(clang::SourceLocation,
llvm::ArrayRef<clang::ParmVarDecl*>, clang::FunctionProtoType::ExtParameterInfo
const*, clang::MultiLevelTemplateArgumentList const&,
llvm::SmallVectorImpl<clang::QualType>&,
llvm::SmallVectorImpl<clang::ParmVarDecl*>*,
clang::Sema::ExtParameterInfoBuilder&)
(/usr/local/clang-trunk/bin/clang-4.0+0x305d7d6)
#28 0x00000000030048bd
clang::Sema::SubstituteExplicitTemplateArguments(clang::FunctionTemplateDecl*,
clang::TemplateArgumentListInfo&,
llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&,
llvm::SmallVectorImpl<clang::QualType>&, clang::QualType*,
clang::sema::TemplateDeductionInfo&)
(/usr/local/clang-trunk/bin/clang-4.0+0x30048bd)
#29 0x0000000003027c66
clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*,
clang::TemplateArgumentListInfo*, clang::QualType, clang::FunctionDecl*&,
clang::sema::TemplateDeductionInfo&, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x3027c66)
#30 0x00000000030281c7
clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*,
clang::TemplateArgumentListInfo*, clang::FunctionDecl*&,
clang::sema::TemplateDeductionInfo&, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x30281c7)
#31 0x0000000002f41ade
clang::Sema::ResolveSingleFunctionTemplateSpecialization(clang::OverloadExpr*,
bool, clang::DeclAccessPair*) (/usr/local/clang-trunk/bin/clang-4.0+0x2f41ade)
#32 0x0000000002f41ede
clang::Sema::ResolveAndFixSingleFunctionTemplateSpecialization(clang::ActionResult<clang::Expr*,
true>&, bool, bool, clang::SourceRange, clang::QualType, unsigned int)
(/usr/local/clang-trunk/bin/clang-4.0+0x2f41ede)
#33 0x0000000002dbee8e clang::Sema::CheckPlaceholderExpr(clang::Expr*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2dbee8e)
#34 0x0000000002e43ca5 clang::Sema::ActOnFinishFullExpr(clang::Expr*,
clang::SourceLocation, bool, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2e43ca5)
#35 0x0000000002f72af0
clang::Sema::ActOnExprStmt(clang::ActionResult<clang::Expr*, true>)
(/usr/local/clang-trunk/bin/clang-4.0+0x2f72af0)
#36 0x0000000002a976bd clang::Parser::ParseExprStatement()
(/usr/local/clang-trunk/bin/clang-4.0+0x2a976bd)
#37 0x0000000002a948c7
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/usr/local/clang-trunk/bin/clang-4.0+0x2a948c7)
#38 0x0000000002a94c8e
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2a94c8e)
#39 0x0000000002a99569 clang::Parser::ParseCompoundStatementBody(bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2a99569)
#40 0x0000000002a9bdb9 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/usr/local/clang-trunk/bin/clang-4.0+0x2a9bdb9)
#41 0x0000000002a17e27
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2a17e27)
#42 0x0000000002a3814d clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2a3814d)
#43 0x0000000002a133a9
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-4.0+0x2a133a9)
#44 0x0000000002a13a61
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) [clone .part.223]
(/usr/local/clang-trunk/bin/clang-4.0+0x2a13a61)
#45 0x0000000002a13a9f
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-4.0+0x2a13a9f)
#46 0x0000000002a18768
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/local/clang-trunk/bin/clang-4.0+0x2a18768)
#47 0x0000000002a192b2
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x2a192b2)
#48 0x0000000002a10683 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2a10683)
#49 0x0000000002629a8e clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-4.0+0x2629a8e)
#50 0x000000000232292e clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-4.0+0x232292e)
#51 0x00000000022f837e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-4.0+0x22f837e)
#52 0x00000000023b18b2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-4.0+0x23b18b2)
#53 0x0000000000b8ff10 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-4.0+0xb8ff10)
#54 0x0000000000b38935 main (/usr/local/clang-trunk/bin/clang-4.0+0xb38935)
#55 0x00007f604d5ffec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#56 0x0000000000b8c0be _start (/usr/local/clang-trunk/bin/clang-4.0+0xb8c0be)
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.cpp -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
-coverage-notes-file /data2/small.gcno -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/4.0.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/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 -w -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir /data2 -ferror-limit 19 -fmessage-length 216
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o small.o -x c++ small.cpp
1. small.cpp:11:3: current parser token 'return'
2. small.cpp:9:1: parsing function body 'main'
3. small.cpp:9:1: in compound statement ('{}')
clang-4.0: error: unable to execute command: Aborted (core dumped)
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 282567)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/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-8418eb.cpp
clang-4.0: note: diagnostic msg: /tmp/small-8418eb.sh
clang-4.0: note: diagnostic msg:
********************
$
----------------------------------------------------------------------
template < bool, class > struct A {};
template < class, int > void f () {};
template < class T, int >
decltype (f < T, 1 >) f (T t, typename A < t == 0, int >::type) {};
struct B {};
int main ()
{
f < B, 0 >;
return 0;
}
--
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/20160929/7be29189/attachment-0001.html>
More information about the llvm-bugs
mailing list