[llvm-bugs] [Bug 48855] New: Assertion failed: !cast<FunctionDecl>(GD.getDecl())->isConsteval() && "consteval function should never be emitted", file clang\lib\CodeGen\CodeGenModule.cpp, line 3530

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 22 19:14:13 PST 2021


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

            Bug ID: 48855
           Summary: Assertion failed:
                    !cast<FunctionDecl>(GD.getDecl())->isConsteval() &&
                    "consteval function should never be emitted", file
                    clang\lib\CodeGen\CodeGenModule.cpp, line 3530
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mizvekov at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Created attachment 24411
  --> https://bugs.llvm.org/attachment.cgi?id=24411&action=edit
auto repro cpp

Compiling the following simple example on a clang debug build (commit )
triggers and assert.

Reproduction:
´´´
template <auto V> struct constant {
  consteval operator auto() const noexcept { return V; }
};
int test() noexcept { return constant<1>{}; }
´´´

Error:
´´´
./clang-cl -std:c++latest /Ox /c test.cc
Assertion failed: !cast<FunctionDecl>(GD.getDecl())->isConsteval() &&
"consteval function should never be emitted", file
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CodeGenModule.cpp,
line 3530
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments:
C:\\Users\\mizve\\source\\repos\\llvm-project\\build_clang\\bin\\clang-cl.exe
-std:c++latest /Ox /c test.cc
1.      <eof> parser at end of file
2.      test.cc:4:5: LLVM IR generation of declaration 'test'
3.      test.cc:4:5: Generating code for declaration 'test'
0x00007FF604DA049C (0x0000005700000016 0x0000000000000000 0x00007FF6000B6767
0x0000000000000000), HandleAbort() + 0xC bytes(s),
C:\Users\mizve\source\repos\llvm-project\llvm\lib\Support\Windows\Signals.inc,
line 408
0x00007FFD67CAC3E1 (0x00007FFD00000016 0x0000005712983B40 0x0000000801000006
0xFFFFFF01000001A2), raise() + 0x441 bytes(s)
0x00007FFD67CAE039 (0x0000005712983B40 0x0000000000000240 0x00007FFD67DAA4E0
0x00007FF6103AEEA0), abort() + 0x39 bytes(s)
0x00007FFD67CB3C65 (0x00007FF6103AEEA0 0x00007FF6103AEE00 0xCCCCCCCC00000DCA
0xCCCCCCCCCCCCCCCC), _get_wide_winmain_command_line() + 0x2515 bytes(s)
0x00007FFD67CB37D7 (0x00007FF6103AEEA0 0x00007FF6103AEE00 0x0000005700000DCA
0xCCCCCCCCCCCCCCCC), _get_wide_winmain_command_line() + 0x2087 bytes(s)
0x00007FFD67CB1841 (0x00007FF6103AEEA0 0x00007FF6103AEE00 0xCCCCCCCC00000DCA
0x00007FF6054AF8DE), _get_wide_winmain_command_line() + 0xF1 bytes(s)
0x00007FFD67CB41CF (0x00007FF6103AEEA0 0x00007FF6103AEE00 0xCCCCCCCC00000DCA
0xCCCCCCCCCCCCCCCC), _wassert() + 0x2F bytes(s)
0x00007FF6054AF8DE (0x000002295E6083A0 0x0000005712985700 0x000002295E60A578
0x000002295E5DFE00), clang::CodeGen::CodeGenModule::GetAddrOfFunction() + 0x7E
bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CodeGenModule.cpp,
line 3529 + 0x4A byte(s)
0x00007FF605DB892E (0x0000005712987B20 0x0000005712985C48 0x000002295E683558
0x000002295E683038),
clang::CodeGen::CodeGenFunction::EmitCXXMemberOrOperatorMemberCallExpr() +
0x162E bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CGExprCXX.cpp, line
408 + 0xB0 byte(s)
0x00007FF605DB72CA (0x0000005712987B20 0x0000005712985C48 0x000002295E683558
0x0000005712985B20), clang::CodeGen::CodeGenFunction::EmitCXXMemberCallExpr() +
0x33A bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CGExprCXX.cpp, line
203 + 0x7B byte(s)
0x00007FF6058F939A (0x0000005712987B20 0x0000005712985C48 0x000002295E683558
0x0000005712985C60), clang::CodeGen::CodeGenFunction::EmitCallExpr() + 0x10A
bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CGExpr.cpp, line
4830 + 0x3C byte(s)
0x00007FF605D4DA0B (0x0000005712987038 0x000002295E683558 0xCCCCCCCCCCCCCCCC
0xCCCCCCCCCCCCCCCC), `anonymous namespace'::ScalarExprEmitter::VisitCallExpr()
+ 0xBB bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CGExprScalar.cpp,
line 571 + 0x3E byte(s)
0x00007FF605D4D352 (0x0000005712987038 0x000002295E683558 0xCCCCCCCCCCCCCCCC
0xCCCCCCCCCCCCCCCC), clang::StmtVisitorBase<std::add_pointer,`anonymous
namespace'::ScalarExprEmitter,llvm::Value *>::VisitCXXMemberCallExpr() + 0x32
bytes(s),
c:\Users\mizve\source\repos\llvm-project\build_clang\include\clang\AST\StmtNodes.inc,
line 823 + 0x32 byte(s)
0x00007FF605D4ACA2 (0x0000005712987038 0x000002295E683558 0x000002295E683558
0xCCCCCCCCCCCCCCCC), clang::StmtVisitorBase<std::add_pointer,`anonymous
namespace'::ScalarExprEmitter,llvm::Value *>::Visit() + 0xE92 bytes(s),
c:\Users\mizve\source\repos\llvm-project\build_clang\include\clang\AST\StmtNodes.inc,
line 823 + 0xF byte(s)
0x00007FF605D4BE19 (0x0000005712987038 0x000002295E683558 0xCCCCCCCCCCCCCCCC
0xCCCCCCCCCCCCCCCC), `anonymous namespace'::ScalarExprEmitter::Visit() + 0x49
bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CGExprScalar.cpp,
line 409 + 0xF byte(s)
0x00007FF605D2D3C3 (0x0000005712987038 0x000002295E683578 0xCCCCCCCCCCCCCCCC
0xCCCCCCCCCCCCCCCC), `anonymous namespace'::ScalarExprEmitter::VisitCastExpr()
+ 0xFC3 bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CGExprScalar.cpp,
line 2093 + 0x12 byte(s)
0x00007FF605D4E972 (0x0000005712987038 0x000002295E683578 0xCCCCCCCCCCCCCCCC
0xCCCCCCCCCCCCCCCC), clang::StmtVisitorBase<std::add_pointer,`anonymous
namespace'::ScalarExprEmitter,llvm::Value *>::VisitImplicitCastExpr() + 0x32
bytes(s),
c:\Users\mizve\source\repos\llvm-project\build_clang\include\clang\AST\StmtNodes.inc,
line 919 + 0x32 byte(s)
0x00007FF605D4AD92 (0x0000005712987038 0x000002295E683578 0x000002295E683578
0xCCCCCCCCCCCCCCCC), clang::StmtVisitorBase<std::add_pointer,`anonymous
namespace'::ScalarExprEmitter,llvm::Value *>::Visit() + 0xF82 bytes(s),
c:\Users\mizve\source\repos\llvm-project\build_clang\include\clang\AST\StmtNodes.inc,
line 919 + 0xF byte(s)
0x00007FF605D4BE19 (0x0000005712987038 0x000002295E683578 0xCCCCCCCCCCCCCC00
0xCCCCCCCCCCCCCCCC), `anonymous namespace'::ScalarExprEmitter::Visit() + 0x49
bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CGExprScalar.cpp,
line 409 + 0xF byte(s)
0x00007FF605D25938 (0x0000005712987B20 0x000002295E683578 0x0000005712987B00
0xCCCCCCCCCCCCCCCC), clang::CodeGen::CodeGenFunction::EmitScalarExpr() + 0x98
bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CGExprScalar.cpp,
line 4744
0x00007FF605CF8204 (0x0000005712987B20 0x000002295E6835A8 0x00000057129874A0
0xCCCCCCCCCCCCCCCC), clang::CodeGen::CodeGenFunction::EmitReturnStmt() + 0x664
bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CGStmt.cpp, line
1218 + 0x36 byte(s)
0x00007FF605CF4273 (0x0000005712987B20 0x000002295E6835A8 0x0000005712987690
0xCCCCCCCCCCCCCCCC), clang::CodeGen::CodeGenFunction::EmitStmt() + 0x433
bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CGStmt.cpp, line 150
+ 0x1D byte(s)
0x00007FF605CF5760 (0x0000005712987B20 0x0000005712987710 0x000002295E6835B8
0xCCCCCCCCCCCCCC00),
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope() + 0x380
bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CGStmt.cpp, line 478
0x00007FF6058C2305 (0x0000005712987B20 0x000002295E6835B8 0x000002295CCBD778
0x000002295CCBD778), clang::CodeGen::CodeGenFunction::EmitFunctionBody() + 0xC5
bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CodeGenFunction.cpp,
line 1180 + 0x46 byte(s)
0x00007FF6058BB17C (0x0000005712987B20 0x0000005712989100 0x000002295CCBD778
0x000002295E5A3DD0), clang::CodeGen::CodeGenFunction::GenerateCode() + 0x4BC
bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CodeGenFunction.cpp,
line 1351
0x00007FF6054C0B0D (0x000002295E6083A0 0x0000005712989310 0x000002295CCBD778
0x0000000000000000),
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition() + 0x24D bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CodeGenModule.cpp,
line 4739 + 0x49 byte(s)
0x00007FF6054C07F4 (0x000002295E6083A0 0x0000005712989520 0x0000000000000000
0xCCCCCCCCCCCCCCCC), clang::CodeGen::CodeGenModule::EmitGlobalDefinition() +
0x3E4 bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CodeGenModule.cpp,
line 3088 + 0x37 byte(s)
0x00007FF6054B9E01 (0x000002295E6083A0 0x000000571298B080 0xCCCCCCCC00000000
0xCCCCCCCCCCCCCCCC), clang::CodeGen::CodeGenModule::EmitGlobal() + 0x7B1
bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CodeGenModule.cpp,
line 2841
0x00007FF6054B36E2 (0x000002295E6083A0 0x000002295E641290 0xCCCCCCCCCCCCCC01
0xCCCCCCCCCCCCCCCC), clang::CodeGen::CodeGenModule::EmitTopLevelDecl() + 0x132
bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CodeGenModule.cpp,
line 5557
0x00007FF60C4BA7CE (0x000002295E602DD0 0x000002295E641290 0xCCCCCCCC00000000
0x000002295E5AD990), `anonymous
namespace'::CodeGeneratorImpl::HandleTopLevelDecl() + 0xAE bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\ModuleBuilder.cpp,
line 170 + 0x23 byte(s)
0x00007FF60C4B39C3 (0x000002295E602780 0x000002295E641290 0x000002295E65F700
0xCCCCCCCCCCCCCC00), clang::BackendConsumer::HandleTopLevelDecl() + 0x133
bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CodeGenAction.cpp,
line 220
0x00007FF609541E39 (0x000002295E65F700 0xCCCCCCCC00000000 0x0000000000000000
0xCCCCCCCCCCCCCCCC), clang::ParseAST() + 0x2F9 bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\Parse\ParseAST.cpp, line 162
+ 0x4C byte(s)
0x00007FF60625A16B (0x000002295E5A6F60 0x000000571298B820 0xCCCCCCCCCCCCCCCC
0xCCCCCCCCCCCCCCCC), clang::ASTFrontendAction::ExecuteAction() + 0x12B
bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\Frontend\FrontendAction.cpp,
line 1058
0x00007FF60C4A7E95 (0x000002295E5A6F60 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC
0xCCCCCCCCCCCCCCCC), clang::CodeGenAction::ExecuteAction() + 0x65 bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\CodeGen\CodeGenAction.cpp,
line 1083
0x00007FF606259AFC (0x000002295E5A6F60 0x000000571298C3E8 0x000002295CD9E0F0
0xCCCCCCCCCCCCCCCC), clang::FrontendAction::Execute() + 0x9C bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\Frontend\FrontendAction.cpp,
line 953
0x00007FF6061CF518 (0x000002295CD99920 0x000002295E5A6F60 0x000000571298C840
0x0000000000000000), clang::CompilerInstance::ExecuteAction() + 0x848 bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\Frontend\CompilerInstance.cpp,
line 959 + 0x15 byte(s)
0x00007FF606454CF5 (0x000002295CD99920 0x000000571298D210 0x000000571298C901
0x000002295CCFD970), clang::ExecuteCompilerInvocation() + 0x705 bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\FrontendTool\ExecuteCompilerInvocation.cpp,
line 278 + 0x1D byte(s)
0x00007FF600463243 (0x000000571298D520 0x000002295CCFD970 0x00007FF600113214
0xCCCCCCCCCCCCCC00), cc1_main() + 0x6C3 bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\tools\driver\cc1_main.cpp, line
240 + 0x12 byte(s)
0x00007FF60044CEA5 (0x000000571298D6E8 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC
0xCCCCCCCCCCCCCCCC), ExecuteCC1Tool() + 0x205 bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\tools\driver\driver.cpp, line
330 + 0x77 byte(s)
0x00007FF60600F746 (0x000000571298DB88 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC
0xCCCCCCCCCCCCCCCC), <lambda_25c96514421f9d21a88a4b637eac86f0>::operator()() +
0x36 bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\Driver\Job.cpp, line 404 +
0x36 byte(s)
0x00007FF60600E8A8 (0x000000571298DB88 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC
0xCCCCCCCCCCCCCCCC), llvm::function_ref<void
__cdecl(void)>::callback_fn<<lambda_25c96514421f9d21a88a4b637eac86f0> >() +
0x28 bytes(s),
C:\Users\mizve\source\repos\llvm-project\llvm\include\llvm\ADT\STLExtras.h,
line 187
0x00007FF604D456FE (0x000000571298DBC0 0x000000571298DB18 0xCCCCCCCCCCCCCCCC
0xCCCCCCCCCCCCCCCC), llvm::function_ref<void __cdecl(void)>::operator()() +
0x2E bytes(s),
C:\Users\mizve\source\repos\llvm-project\llvm\include\llvm\ADT\STLExtras.h,
line 210
0x00007FF604D5581F (0x000000571298DB18 0x000000571298DBC0 0x0000000000000000
0x0000000000000000), llvm::CrashRecoveryContext::RunSafely() + 0xBF bytes(s),
C:\Users\mizve\source\repos\llvm-project\llvm\lib\Support\CrashRecoveryContext.cpp,
line 233 + 0xA byte(s)
0x00007FF60600B98E (0x000002295CDA2210 0x000000571298DDB0 0x000000571298DCB8
0x000000571298DCF4), clang::driver::CC1Command::Execute() + 0x1FE bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\Driver\Job.cpp, line 404 +
0x72 byte(s)
0x00007FF605F423E3 (0x000002295CD14A40 0x000002295CDA2210 0x000000571298DE88
0xCCCCCCCCCCCCCCCC), clang::driver::Compilation::ExecuteCommand() + 0x393
bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\Driver\Compilation.cpp, line
195 + 0x71 byte(s)
0x00007FF605F4261A (0x000002295CD14A40 0x000002295CD14AC8 0x000000571298F828
0xCCCCCCCCCCCCCCCC), clang::driver::Compilation::ExecuteJobs() + 0xCA bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\lib\Driver\Compilation.cpp, line
248 + 0x17 byte(s)
0x00007FF605EE7099 (0x000000571298F348 0x000002295CD14A40 0x000000571298F828
0x000000571298ED48), clang::driver::Driver::ExecuteCompilation() + 0x159
bytes(s), C:\Users\mizve\source\repos\llvm-project\clang\lib\Driver\Driver.cpp,
line 1517
0x00007FF60044E1B7 (0x0000000000000005 0x000002295CD329E0 0x0000000000000000
0x00007FF60C0DFA4D), main() + 0x1027 bytes(s),
C:\Users\mizve\source\repos\llvm-project\clang\tools\driver\driver.cpp, line
502 + 0x25 byte(s)
0x00007FF60C0DF349 (0x00007FF60C761000 0x00007FF60C76D158 0x0000000000000000
0x0000000000000000), invoke_main() + 0x39 bytes(s),
d:\agent\_work\31\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line
79
0x00007FF60C0DF1EE (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000), __scrt_common_main_seh() + 0x12E bytes(s),
d:\agent\_work\31\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line
288 + 0x5 byte(s)
0x00007FF60C0DF0AE (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000), __scrt_common_main() + 0xE bytes(s),
d:\agent\_work\31\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line
331
0x00007FF60C0DF3DE (0x0000005711F33000 0x0000000000000000 0x0000000000000000
0x0000000000000000), mainCRTStartup() + 0xE bytes(s),
d:\agent\_work\31\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp, line 17
0x00007FFD9D027034 (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)
0x00007FFD9D15D0D1 (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)
clang-cl: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 12.0.0
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Users\mizve\source\repos\llvm-project\build_clang\bin
clang-cl: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-cl: note: diagnostic msg:
C:\Users\mizve\AppData\Local\Temp\test-2a12f9.cpp
clang-cl: note: diagnostic msg:
C:\Users\mizve\AppData\Local\Temp\test-2a12f9.sh
clang-cl: note: diagnostic msg:

********************
´´´

-- 
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/20210123/3a9fc799/attachment-0001.html>


More information about the llvm-bugs mailing list