Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

clang crashes parsing this program #32027

Open Quuxplusone opened 7 years ago

Quuxplusone commented 7 years ago
Bugzilla Link PR33055
Status NEW
Importance P normal
Reported by Thomas Folz-Donahue (eigenlambda@gmail.com)
Reported on 2017-05-15 19:07:16 -0700
Last modified on 2017-05-15 19:27:51 -0700
Version 4.0
Hardware PC Linux
CC george.burgess.iv@gmail.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments vpf5_1CalculatorCode-28317f.sh (6003 bytes, application/x-shellscript)
Blocks
Blocked by
See also
So this happened

#0 0x00007ff284e6b758 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib/x86_64-linux-gnu/libLLVM-4.0.so.1+0x70e758)
#1 0x00007ff284e698de llvm::sys::RunSignalHandlers() (/usr/lib/x86_64-linux-
gnu/libLLVM-4.0.so.1+0x70c8de)
#2 0x00007ff284e69a2c (/usr/lib/x86_64-linux-gnu/libLLVM-4.0.so.1+0x70ca2c)
#3 0x00007ff2876bc390 __restore_rt (/lib/x86_64-linux-
gnu/libpthread.so.0+0x11390)
#4 0x0000000001212d15 clang::Sema::AddMethodCandidate(clang::CXXMethodDecl*,
clang::DeclAccessPair, clang::CXXRecordDecl*, clang::QualType,
clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>,
clang::OverloadCandidateSet&, bool, bool,
llvm::MutableArrayRef<clang::ImplicitConversionSequence>) (/usr/lib/llvm-
4.0/bin/clang+0x1212d15)
#5 0x0000000001213c3e clang::Sema::AddMethodCandidate(clang::DeclAccessPair,
clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>,
clang::OverloadCandidateSet&, bool) (/usr/lib/llvm-4.0/bin/clang+0x1213c3e)
#6 0x0000000001213ec5
clang::Sema::AddMemberOperatorCandidates(clang::OverloadedOperatorKind,
clang::SourceLocation, llvm::ArrayRef<clang::Expr*>,
clang::OverloadCandidateSet&, clang::SourceRange) (/usr/lib/llvm-
4.0/bin/clang+0x1213ec5)
#7 0x000000000122368c
clang::Sema::CreateOverloadedArraySubscriptExpr(clang::SourceLocation,
clang::SourceLocation, clang::Expr*, clang::Expr*) (/usr/lib/llvm-
4.0/bin/clang+0x122368c)
#8 0x00000000010bb6e4 clang::Sema::ActOnArraySubscriptExpr(clang::Scope*,
clang::Expr*, clang::SourceLocation, clang::Expr*, clang::SourceLocation)
(/usr/lib/llvm-4.0/bin/clang+0x10bb6e4)
#9 0x0000000000dab9f6
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) (/usr/lib/llvm-4.0/bin/clang+0xdab9f6)
#10 0x0000000000da60eb clang::Parser::ParseCastExpression(bool, bool, bool&,
clang::Parser::TypeCastState) (/usr/lib/llvm-4.0/bin/clang+0xda60eb)
#11 0x0000000000da862d clang::Parser::ParseCastExpression(bool, bool,
clang::Parser::TypeCastState) (/usr/lib/llvm-4.0/bin/clang+0xda862d)
#12 0x0000000000da86c9
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/usr/lib/llvm-4.0/bin/clang+0xda86c9)
#13 0x0000000000da88d7
clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*,
true>, clang::prec::Level) (/usr/lib/llvm-4.0/bin/clang+0xda88d7)
#14 0x0000000000da86d9
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/usr/lib/llvm-4.0/bin/clang+0xda86d9)
#15 0x0000000000da8749
clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/usr/lib/llvm-
4.0/bin/clang+0xda8749)
#16 0x0000000000deb830 clang::Parser::ParseExprStatement() (/usr/lib/llvm-
4.0/bin/clang+0xdeb830)
#17 0x0000000000de917f
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&) (/usr/lib/llvm-
4.0/bin/clang+0xde917f)
#18 0x0000000000de93ce
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*)
(/usr/lib/llvm-4.0/bin/clang+0xde93ce)
#19 0x0000000000ded969 clang::Parser::ParseCompoundStatementBody(bool)
(/usr/lib/llvm-4.0/bin/clang+0xded969)
#20 0x0000000000dedffe clang::Parser::ParseCompoundStatement(bool, unsigned
int) (/usr/lib/llvm-4.0/bin/clang+0xdedffe)
#21 0x0000000000dee032 clang::Parser::ParseCompoundStatement(bool)
(/usr/lib/llvm-4.0/bin/clang+0xdee032)
#22 0x0000000000de8f72
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&) (/usr/lib/llvm-
4.0/bin/clang+0xde8f72)
#23 0x0000000000de93ce
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*)
(/usr/lib/llvm-4.0/bin/clang+0xde93ce)
#24 0x0000000000de9544 clang::Parser::ParseStatement(clang::SourceLocation*,
bool) (/usr/lib/llvm-4.0/bin/clang+0xde9544)
#25 0x0000000000de9f3d clang::Parser::ParseForStatement(clang::SourceLocation*)
(/usr/lib/llvm-4.0/bin/clang+0xde9f3d)
#26 0x0000000000de8e2b
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&) (/usr/lib/llvm-
4.0/bin/clang+0xde8e2b)
#27 0x0000000000de93ce
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*)
(/usr/lib/llvm-4.0/bin/clang+0xde93ce)
#28 0x0000000000ded969 clang::Parser::ParseCompoundStatementBody(bool)
(/usr/lib/llvm-4.0/bin/clang+0xded969)
#29 0x0000000000df00ae clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/usr/lib/llvm-4.0/bin/clang+0xdf00ae)
#30 0x0000000000d68224
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/usr/lib/llvm-4.0/bin/clang+0xd68224)
#31 0x0000000000dfb9ac
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*)
(/usr/lib/llvm-4.0/bin/clang+0xdfb9ac)
#32 0x0000000000dfcbcd
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*)
(/usr/lib/llvm-4.0/bin/clang+0xdfcbcd)
#33 0x0000000000dfcdbf
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*)
(/usr/lib/llvm-4.0/bin/clang+0xdfcdbf)
#34 0x0000000000d8ae4d clang::Parser::ParseDeclaration(unsigned int,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&)
(/usr/lib/llvm-4.0/bin/clang+0xd8ae4d)
#35 0x0000000000d6a751
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/lib/llvm-4.0/bin/clang+0xd6a751)
#36 0x0000000000d6b0d7
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/lib/llvm-4.0/bin/clang+0xd6b0d7)
#37 0x0000000000d601ab clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-
4.0/bin/clang+0xd601ab)
#38 0x0000000000b206de clang::FrontendAction::Execute() (/usr/lib/llvm-
4.0/bin/clang+0xb206de)
#39 0x0000000000af0e96
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-
4.0/bin/clang+0xaf0e96)
#40 0x0000000000b9f402
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-
4.0/bin/clang+0xb9f402)
#41 0x00000000007c8f18 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm-4.0/bin/clang+0x7c8f18)
#42 0x00000000007ba0ce main (/usr/lib/llvm-4.0/bin/clang+0x7ba0ce)
#43 0x00007ff2838e2830 __libc_start_main (/lib/x86_64-linux-
gnu/libc.so.6+0x20830)
#44 0x00000000007c72c9 _start (/usr/lib/llvm-4.0/bin/clang+0x7c72c9)
Stack dump:
0.      Program arguments: /usr/lib/llvm-4.0/bin/clang -cc1 -triple x86_64-pc-
linux-gnu -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -
main-file-name vpf5_1CalculatorCode.cpp -mrelocation-model static -mthread-
model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -
fuse-init-array -target-cpu haswell -target-feature +sse2 -target-feature +cx16
-target-feature -tbm -target-feature -avx512ifma -target-feature -avx512dq -
target-feature -fma4 -target-feature -prfchw -target-feature -bmi2 -target-
feature -xsavec -target-feature +fsgsbase -target-feature +popcnt -target-
feature -aes -target-feature -pcommit -target-feature -xsaves -target-feature -
avx512er -target-feature -clwb -target-feature -avx512f -target-feature -pku -
target-feature -smap -target-feature +mmx -target-feature -xop -target-feature -
rdseed -target-feature -hle -target-feature -sse4a -target-feature -avx512bw -
target-feature -clflushopt -target-feature -xsave -target-feature -avx512vl -
target-feature +invpcid -target-feature -avx512cd -target-feature -avx -target-
feature -rtm -target-feature -fma -target-feature -bmi -target-feature -mwaitx -
target-feature +rdrnd -target-feature +sse4.1 -target-feature +sse4.2 -target-
feature -avx2 -target-feature +sse -target-feature +lzcnt -target-feature
+pclmul -target-feature -prefetchwt1 -target-feature -f16c -target-feature
+ssse3 -target-feature -sgx -target-feature +cmov -target-feature -avx512vbmi -
target-feature +movbe -target-feature -xsaveopt -target-feature -sha -target-
feature -adx -target-feature -avx512pf -target-feature +sse3 -momit-leaf-frame-
pointer -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file
/home/user/calculator/src/vpf5_1CalculatorCode.gcno -resource-dir /usr/lib/llvm-
4.0/bin/../lib/clang/4.0.1 -dependency-file src/vpf5_1CalculatorCode.d -MT
src/vpf5_1CalculatorCode.o -MP -D MACRO_use_open_ssl -D MACRO_use_MySQL -
internal-isystem /usr/bin/../lib/gcc/x86_64-linux-
gnu/5.4.0/../../../../include/c++/5.4.0 -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-
gnu/c++/5.4.0 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-
gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0 -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-
gnu/5.4.0/../../../../include/c++/5.4.0/backward -internal-isystem
/usr/include/clang/4.0.1/include/ -internal-isystem /usr/local/include -
internal-isystem /usr/lib/llvm-4.0/bin/../lib/clang/4.0.1/include -internal-
externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem
/include -internal-externc-isystem /usr/include -O3 -Wall -Wno-address -
std=c++0x -fdeprecated-macro -fdebug-compilation-dir /home/user/calculator -
ferror-limit 19 -fmessage-length 80 -fopenmp -pthread -fobjc-runtime=gcc -fcxx-
exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -
vectorize-loops -vectorize-slp -o src/vpf5_1CalculatorCode.o -x c++
src/vpf5_1CalculatorCode.cpp
1.      src/vpfImplementationHeader2Math1_SemisimpleLieAlgebras.h:116:43:
current parser token ']'
2.      src/vpfImplementationHeader2Math1_SemisimpleLieAlgebras.h:82:1: parsing
function body 'Weight::TensorAndDecompose'
3.      src/vpfImplementationHeader2Math1_SemisimpleLieAlgebras.h:82:1: in
compound statement ('{}')
4.      src/vpfImplementationHeader2Math1_SemisimpleLieAlgebras.h:116:3: in
compound statement ('{}')
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.1-svn301605-1~exp1 (branches/release_40)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
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/vpf5_1CalculatorCode-28317f.cpp
clang: note: diagnostic msg: /tmp/vpf5_1CalculatorCode-28317f.sh
clang: note: diagnostic msg:
Quuxplusone commented 7 years ago

Attached vpf5_1CalculatorCode-28317f.sh (6003 bytes, application/x-shellscript): clang command

Quuxplusone commented 7 years ago

Preprocessed cpp is larger than would fit here, so https://transfer.sh/Ia8Im/vpf5_1CalculatorCode-28317f.cpp

Quuxplusone commented 7 years ago
Thanks again!

Reduced test-case (repros on trunk):

using DontCare = int;

template <DontCare>
struct Templated {};

template <typename Object, DontCare fn = Object::HashFunction>
struct SubTemplated : Templated<fn> {};

struct Foo {
  DontCare HashFunction() const;
  static DontCare HashFunction(const Foo &);
};

template <class> struct Baz {
  void foo() { SubTemplated<Foo> f; }
};

void run() {
  Baz<DontCare> baz;
  baz.foo();
}

This trips an assertion: ../../tools/clang/lib/Sema/SemaInit.cpp:6505:
ExprResult clang::InitializationSequence::Perform(clang::Sema &, const
clang::InitializedEntity &, const clang::InitializationKind &, MultiExprArg,
clang::QualType *): Assertion `Kind.getKind() == InitializationKind::
IK_Copy || Kind.isExplicitCast() || Kind.getKind() ==
InitializationKind::IK_DirectList' failed.