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

clang-cl crash with constexpr ctor

Open KarstenH opened this issue 9 years ago • 10 comments

Bugzilla Link 34858
Resolution FIXED
Resolved on Dec 08, 2017 06:50
Version trunk
OS Windows NT
CC @Ivan171,@rnk

Extended Description

struct S { constexpr S(int const & = 0) {} };

S a[2]; // crash, see log below and attached files S b[2] {}; // crash // In contrast: S c[2] {0}; // OK S d[1]; // OK S e[1] {}; // OK


1>Assertion failed: Result.isUninit() && "temporary created multiple times", file C:\src\llvm_package_314411\llvm\tools\clang\lib\AST\ExprConstant.cpp, line 1107 1>Wrote crash dump file "C:\Users\x\AppData\Local\Temp\CL.exe-308f23.dmp" 1>0x01E82CA8 (0x00000016 0x04A7D360 0x768A8350 0x00000003) 1>0x768453E2 (0x04A7E2AE 0x04A7D360 0x001803B8 0x058CCBBC), abort() + 0x32 bytes(s) 1>0x76846CE7 (0x00000453 0x0ADD3A00 0x058CD7A0 0x058CCBCC), _get_wpgmptr() + 0x1777 bytes(s) 1>0x7684614B (0x00000453 0x036AE040 0x001803A0 0x036AE040), _get_wpgmptr() + 0xBDB bytes(s) 1>0x76846DE6 (0x04A7E2AE 0x04A7D360 0x00000453 0x058CCC44), _wassert() + 0x16 bytes(s) 1>0x036AE040 (0x00000000 0x0ADD3B30 0x058CD7A0 0x0ADD3A00) 1>0x036A5F3C (0x774137EE 0x774E6E38 0x00000050 0x000A0000) 1>0x036A21BA (0x058CCDC4 0x767CE7EB 0x000A0000 0x00000000) 1>0x036A3B7D (0x058CD788 0x058CCEC0 0x00102800 0x268D563B) 1>0x03694C57 (0x058CD914 0x03634A6E 0x00129FF0 0x0ADD3B30) 1>0x02BF19E8 (0x00129FF0 0x0ADD3B30 0x0ADCBDD0 0x00000001) 1>0x03634A6E (0x058CD930 0x058CD93C 0x058CD9B0 0x00000000) 1>0x02BB0EE7 (0x00000000 0x268D563B 0x058CD97C 0x058CD9A8) 1>clang-cl.exe : error : clang frontend command failed due to signal (use -v to see invocation) 1>clang version 6.0.0 (trunk) 1>Target: i686-pc-windows-msvc 1>Thread model: posix 1>InstalledDir: C:\Program Files (x86)\LLVM\msbuild-bin 1>clang-cl.exe: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script. 1>clang-cl.exe: note: diagnostic msg: 1>******************** 1> 1>PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: 1>Preprocessed source(s) and associated run script(s) are located at: 1>clang-cl.exe: note: diagnostic msg: C:\Users\x\AppData\Local\Temp\State1-fca48a.cpp 1>clang-cl.exe: note: diagnostic msg: C:\Users\x\AppData\Local\Temp\State1-fca48a.sh 1>clang-cl.exe: note: diagnostic msg: 1> 1>********************

KarstenH avatar Oct 06 '17 07:10 KarstenH

I put up a patch for this here: https://reviews.llvm.org/D40372

Yes, it's working now. Thanks!

KarstenH avatar Dec 08 '17 14:12 KarstenH

I put up a patch for this here: https://reviews.llvm.org/D40372

llvmbot avatar Nov 22 '17 19:11 llvmbot

Actually, while it doesn't crash on Windows, it does so on Linux for some reason. Reopening.

It still crashes with the latest snapshot build SVN r318667 (20 November 2017).

Jup, I noticed too. Actually, it didn't crash when I was tested it because I had -fsyntax-only, which doesn't build the AST in the same way I guess. Sorry for the confusion :(

llvmbot avatar Nov 21 '17 20:11 llvmbot

Actually, while it doesn't crash on Windows, it does so on Linux for some reason. Reopening.

It still crashes with the latest snapshot build SVN r318667 (20 November 2017).

KarstenH avatar Nov 21 '17 20:11 KarstenH

Crashes for me on Windows. Might just be that your windows build doesn't have assertions enabled.

My stack trace: #​4 _wassert minkernel\crts\ucrt\src\appcrt\startup\assert.cpp:443:0 #​5 anonymous namespace'::CallStackFrame::createTemporary C:\src\llvm-project\clang\lib\AST\ExprConstant.cpp:1167:0 #&#8203;6 anonymous namespace'::LValueExprEvaluator::VisitMaterializeTemporaryExpr C:\src\llvm-project\clang\lib\AST\ExprConstant.cpp:5250:0 #​7 EvaluateLValue C:\src\llvm-project\clang\lib\AST\ExprConstant.cpp:5153:0 #​8 Evaluate C:\src\llvm-project\clang\lib\AST\ExprConstant.cpp:9903:0 #​9 EvaluateArgs C:\src\llvm-project\clang\lib\AST\ExprConstant.cpp:4243:0 #​10 HandleConstructorCall C:\src\llvm-project\clang\lib\AST\ExprConstant.cpp:4457:0 #​11 anonymous namespace'::RecordExprEvaluator::VisitCXXConstructExpr C:\src\llvm-project\clang\lib\AST\ExprConstant.cpp:6372:0 #&#8203;12 anonymous namespace'::ArrayExprEvaluator::VisitCXXConstructExpr C:\src\llvm-project\clang\lib\AST\ExprConstant.cpp:6928:0 #​13 anonymous namespace'::ArrayExprEvaluator::VisitCXXConstructExpr C:\src\llvm-project\clang\lib\AST\ExprConstant.cpp:6916:0 #&#8203;14 anonymous namespace'::ArrayExprEvaluator::VisitCXXConstructExpr C:\src\llvm-project\clang\lib\AST\ExprConstant.cpp:6889:0 #​15 EvaluateArray C:\src\llvm-project\clang\lib\AST\ExprConstant.cpp:6787:0 #​16 EvaluateInPlace C:\src\llvm-project\clang\lib\AST\ExprConstant.cpp:9991:0 #​17 clang::Expr::EvaluateAsInitializer(class clang::APValue &,class clang::ASTContext const &,class clang::VarDecl const *,class llvm::SmallVectorImpl<struct std::pair<class clang::SourceLocation,class clang::PartialDiagnostic> > &)const C:\src\llvm-project\clang\lib\AST\ExprConstant.cpp:10158:0 #​18 clang::VarDecl::evaluateValue(class llvm::SmallVectorImpl<struct std::pair<class clang::SourceLocation,class clang::PartialDiagnostic> > &)const C:\src\llvm-project\clang\lib\AST\Decl.cpp:2230:0 #​19 clang::VarDecl::evaluateValue(void)const C:\src\llvm-project\clang\lib\AST\Decl.cpp:2205:0 #​20 clang::CodeGen::ConstantEmitter::tryEmitPrivateForVarInit(class clang::VarDecl const &) C:\src\llvm-project\clang\lib\CodeGen\CGExprConstant.cpp:1406:0 #​21 clang::CodeGen::ConstantEmitter::tryEmitForInitializer(class clang::VarDecl const &) C:\src\llvm-project\clang\lib\CodeGen\CGExprConstant.cpp:1183:0 #​22 clang::CodeGen::CodeGenModule::EmitGlobalVarDefinition(class clang::VarDecl const *,bool) C:\src\llvm-project\clang\lib\CodeGen\CodeGenModule.cpp:2776:0 #​23 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(class clang::GlobalDecl,class llvm::GlobalValue *) C:\src\llvm-project\clang\lib\CodeGen\CodeGenModule.cpp:2043:0 #​24 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(class clang::Decl *) C:\src\llvm-project\clang\lib\CodeGen\CodeGenModule.cpp:4018:0 #​25 `anonymous namespace'::CodeGeneratorImpl::HandleTopLevelDecl C:\src\llvm-project\clang\lib\CodeGen\ModuleBuilder.cpp:159:0 #​26 clang::BackendConsumer::HandleTopLevelDecl(class clang::DeclGroupRef) C:\src\llvm-project\clang\lib\CodeGen\CodeGenAction.cpp:170:0 #​27 clang::ParseAST(class clang::Sema &,bool,bool) C:\src\llvm-project\clang\lib\Parse\ParseAST.cpp:151:0 #​28 clang::FrontendAction::Execute(void) C:\src\llvm-project\clang\lib\Frontend\FrontendAction.cpp:901:0 #​29 clang::CompilerInstance::ExecuteAction(class clang::FrontendAction &) C:\src\llvm-project\clang\lib\Frontend\CompilerInstance.cpp:992:0 #​30 clang::ExecuteCompilerInvocation(class clang::CompilerInstance *) C:\src\llvm-project\clang\lib\FrontendTool\ExecuteCompilerInvocation.cpp:252:0 #​31 cc1_main(class llvm::ArrayRef<char const *>,char const *,void *) C:\src\llvm-project\clang\tools\driver\cc1_main.cpp:221:0 #​32 ExecuteCC1Tool C:\src\llvm-project\clang\tools\driver\driver.cpp:309:0 #​33 main C:\src\llvm-project\clang\tools\driver\driver.cpp:388:0 #​34 __scrt_common_main_seh f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283:0

rnk avatar Nov 20 '17 21:11 rnk

Actually, while it doesn't crash on Windows, it does so on Linux for some reason. Reopening.

llvmbot avatar Nov 20 '17 16:11 llvmbot

Thanks for reporting! This has been fixed some time ago; don't know which revision though. :)

But not in clang for Windows: in SVN r316086 (18 October 2017) it still crashes. I checked it one minute ago.

Well, then it was fixed after r316086. I also have clang on Windows, and on r318601 (which is from yesterday) it didn't crash.

OK, that's fine, then I just have to wait for the next snapshot build. By the way, this implicitly resolves bug 32822 that I reported. Thanks.

KarstenH avatar Nov 20 '17 07:11 KarstenH

Thanks for reporting! This has been fixed some time ago; don't know which revision though. :)

But not in clang for Windows: in SVN r316086 (18 October 2017) it still crashes. I checked it one minute ago.

Well, then it was fixed after r316086. I also have clang on Windows, and on r318601 (which is from yesterday) it didn't crash.

llvmbot avatar Nov 19 '17 20:11 llvmbot

Thanks for reporting! This has been fixed some time ago; don't know which revision though. :)

But not in clang for Windows: in SVN r316086 (18 October 2017) it still crashes. I checked it one minute ago.

KarstenH avatar Nov 19 '17 18:11 KarstenH

Thanks for reporting! This has been fixed some time ago; don't know which revision though. :)

llvmbot avatar Nov 19 '17 09:11 llvmbot