llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Regression: clang crashes when processing operator() call in a lambda

Open w2yehia opened this issue 7 years ago • 3 comments

Bugzilla Link 43242
Resolution FIXED
Resolved on Sep 09, 2019 16:54
Version trunk
OS Linux
CC @DougGregor,@zygoloid

Extended Description

This started failing some time after SVN change #​370966 (it was clean with 370966).

cat t.cpp int main() { [&](int x){ operator()(); }(); }

clang++ -std=c++11 -c t.cpp t.cpp:2:14: error: use of undeclared 'operator()' [&](int x){ operator()(); }(); ^ this-> t.cpp:2:2: note: must qualify identifier to find this declaration in dependent base class [&](int x){ operator()(); }(); ^ t.cpp:2:14: error: call to non-static member function without an object argument [&](int x){ operator()(); }(); ^~~~~~~~ clang-10: ~/Source/llvm-project/clang/include/clang/AST/Type.h:659: const clang::ExtQualsTypeCommonBase *clang::QualType::getCommonPtr() const: Assertion `!isNull() && "Cannot retrieve a NULL type pointer"' failed.
Stack dump:

  1.  Program arguments: /home/wyehia/build/bin/clang-10 -cc1 -triple powerpc64le-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name t.cpp -mrelocation-model static -mthread-model posix -mframe-pointer=all -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu ppc64le -mfloat-abi hard -target-abi elfv2 -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file /tmp/t.gcno -resource-dir /home/wyehia/build/lib/clang/10.0.0 -internal-isystem /usr/lib/gcc/powerpc64le-linux-gnu/7.3.0/../../../../include/c++/7.3.0 -internal-isystem /usr/lib/gcc/powerpc64le-linux-gnu/7.3.0/../../../../include/powerpc64le-linux-gnu/c++/7.3.0 -internal-isystem /usr/lib/gcc/powerpc64le-linux-gnu/7.3.0/../../../../include/powerpc64le-linux-gnu/c++/7.3.0 -internal-isystem /usr/lib/gcc/powerpc64le-linux-gnu/7.3.0/../../../../include/c++/7.3.0/backward -internal-isystem /home/wyehia/build/lib/clang/10.0.0/include/ppc_wrappers -internal-isystem /usr/local/include -internal-isystem /home/wyehia/build/lib/clang/10.0.0/include -internal-externc-isystem /usr/include/powerpc64le-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 0 -fno-signed-char -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -faddrsig -o t.o -x c++ t.cpp
    
  2.  t.cpp:2:29: current parser token '('
    
  3.  t.cpp:1:12: parsing function body 'main'
    
  4.  t.cpp:1:12: in compound statement ('{}')
    
  5.  t.cpp:2:2: lambda expression parsing
    

#​0 0x00007caa60c36d04 PrintStackTraceSignalHandler(void*) (/home/wyehia/build/bin/../lib/libLLVMSupport.so.10svn+0x1d6d04) #​1 0x00007caa60c33f38 llvm::sys::RunSignalHandlers() (/home/wyehia/build/bin/../lib/libLLVMSupport.so.10svn+0x1d3f38) #​2 0x00007caa60c37150 SignalHandler(int) (/home/wyehia/build/bin/../lib/libLLVMSupport.so.10svn+0x1d7150) #​3 0x00007caa66c604d8 (linux-vdso64.so.1+0x4d8) #​4 0x00007caa5edee98c __libc_signal_restore_set /build/glibc-uvws04/glibc-2.27/signal/../sysdeps/unix/sysv/linux/nptl-signals.h:80:0 #​5 0x00007caa5edee98c raise /build/glibc-uvws04/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:48:0 #​6 0x00007caa5edf0be0 abort /build/glibc-uvws04/glibc-2.27/stdlib/abort.c:79:0 #​7 0x00007caa5eddbb38 __assert_fail_base /build/glibc-uvws04/glibc-2.27/assert/assert.c:92:0 #​8 0x00007caa5eddbbe4 __assert_fail /build/glibc-uvws04/glibc-2.27/assert/assert.c:101:0 #​9 0x00007caa5cb43f6c clang::Sema::BuildCXXThisExpr(clang::SourceLocation, clang::QualType, bool) (/home/wyehia/build/bin/../lib/../lib/libclangSema.so.10svn+0x4e3f6c) #​10 0x00007caa5cc1841c clang::Sema::BuildCaptureInit(clang::sema::Capture const&, clang::SourceLocation, bool) (/home/wyehia/build/bin/../lib/../lib/libclangSema.so.10svn+0x5b841c) #​11 0x00007caa5cc18dc8 clang::Sema::BuildLambdaExpr(clang::SourceLocation, clang::SourceLocation, clang::sema::LambdaScopeInfo*) (/home/wyehia/build/bin/../lib/../lib/libclangSema.so.10svn+0x5b8dc8) #​12 0x00007caa5cc1866c clang::Sema::ActOnLambdaExpr(clang::SourceLocation, clang::Stmt*, clang::Scope*) (/home/wyehia/build/bin/../lib/../lib/libclangSema.so.10svn+0x5b866c) #​13 0x00007caa5d165944 clang::Parser::ParseLambdaExpressionAfterIntroducer(clang::LambdaIntroducer&) (/home/wyehia/build/bin/../lib/../lib/libclangParse.so.10svn+0x95944) #​14 0x00007caa5d163150 clang::Parser::ParseLambdaExpression() (/home/wyehia/build/bin/../lib/../lib/libclangParse.so.10svn+0x93150) #​15 0x00007caa5d1525e8 clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState, bool) (/home/wyehia/build/bin/../lib/../lib/libclangParse.so.10svn+0x825e8) #​16 0x00007caa5d14d5cc clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/home/wyehia/build/bin/../lib/../lib/libclangParse.so.10svn+0x7d5cc) #​17 0x00007caa5d14d480 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/home/wyehia/build/bin/../lib/../lib/libclangParse.so.10svn+0x7d480) #​18 0x00007caa5d1a856c clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/home/wyehia/build/bin/../lib/../lib/libclangParse.so.10svn+0xd856c) #​19 0x00007caa5d1a68fc clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) (/home/wyehia/build/bin/../lib/../lib/libclangParse.so.10svn+0xd68fc)

w2yehia avatar Sep 06 '19 14:09 w2yehia

Fixed in r371468. Thanks for the report and the reduced testcase!

assigned to @zygoloid

w2yehia avatar Sep 06 '19 14:09 w2yehia