[llvm-bugs] [Bug 46926] New: Assertion: "Initializer for struct element doesn't match!"

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 30 21:32:26 PDT 2020


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

            Bug ID: 46926
           Summary: Assertion: "Initializer for struct element doesn't
                    match!"
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: thrimbor.github at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Created attachment 23797
  --> https://bugs.llvm.org/attachment.cgi?id=23797&action=edit
Files requested by the error output

I discovered this on a release build of clang 10.0.1, but reproduced it on a
debug build of 10.0.1 and the current master
(ec1445c5afda7f145a414f11c9103c87a4c1823f).
In the release build, the error message was "fatal error: error in backend:
Type mismatch in constant table!".
Somehow the inclusion of the type_info constructor seems to trigger this issue.
but I can work around it by moving the whole struct and the function
definitions into a different file.


clang-10: /SSDATA/llvm-project/llvm/lib/IR/Constants.cpp:1147:
llvm::ConstantAggregate::ConstantAggregate(llvm::Type*, llvm::Value::ValueTy,
llvm::ArrayRef<llvm::Constant*>): Assertion `V[I]->getType() ==
ST->getTypeAtIndex(I) && "Initializer for struct element doesn't match!"'
failed.
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: /SSDATA/llvm-project/build/bin/clang-10 -cc1 -triple
i386-pc-windows-msvc19.11.0 -emit-llvm-bc -emit-llvm-uselists -save-temps=cwd
-disable-free -main-file-name main.cpp -mrelocation-model static
-mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases
-ffreestanding -target-cpu pentium3 -resource-dir
/SSDATA/llvm-project/build/lib/clang/12.0.0 -Wno-ignored-attributes
-fdeprecated-macro -fdebug-compilation-dir
/home/venom/Sync/xbox_dev/nxdk-txmltest/samples/hello++ -ferror-limit 19
-fno-builtin -fno-rtti -fno-use-cxa-atexit -fms-extensions -fms-compatibility
-fms-compatibility-version=19.11 -std=c++14 -fdelayed-template-parsing
-fcxx-exceptions -fexceptions -fcolor-diagnostics -disable-llvm-passes
-faddrsig -o main.bc -x c++-cpp-output main.ii 
1.      <eof> parser at end of file
2.      /home/venom/Sync/xbox_dev/nxdk-txmltest/samples/hello++/main.cpp:35:5:
LLVM IR generation of declaration 'main'
3.      /home/venom/Sync/xbox_dev/nxdk-txmltest/samples/hello++/main.cpp:35:5:
Generating code for declaration 'main'
 #0 0x00005626c66e9711 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/SSDATA/llvm-project/llvm/lib/Support/Unix/Signals.inc:564:22
 #1 0x00005626c66e97a4 PrintStackTraceSignalHandler(void*)
/SSDATA/llvm-project/llvm/lib/Support/Unix/Signals.inc:625:1
 #2 0x00005626c66e756f llvm::sys::RunSignalHandlers()
/SSDATA/llvm-project/llvm/lib/Support/Signals.cpp:68:20
 #3 0x00005626c66e90a0 SignalHandler(int)
/SSDATA/llvm-project/llvm/lib/Support/Unix/Signals.inc:406:1
 #4 0x00007f45d7162960 __restore_rt (/usr/lib/libpthread.so.0+0x14960)
 #5 0x00007f45d6be9355 raise (/usr/lib/libc.so.6+0x3c355)
 #6 0x00007f45d6bd2853 abort (/usr/lib/libc.so.6+0x25853)
 #7 0x00007f45d6bd2727 _nl_load_domain.cold (/usr/lib/libc.so.6+0x25727)
 #8 0x00007f45d6be1936 (/usr/lib/libc.so.6+0x34936)
 #9 0x00005626c5c25457 llvm::ConstantAggregate::ConstantAggregate(llvm::Type*,
llvm::Value::ValueTy, llvm::ArrayRef<llvm::Constant*>)
/SSDATA/llvm-project/llvm/lib/IR/Constants.cpp:1147:7
#10 0x00005626c5c259c4 llvm::ConstantStruct::ConstantStruct(llvm::StructType*,
llvm::ArrayRef<llvm::Constant*>)
/SSDATA/llvm-project/llvm/lib/IR/Constants.cpp:1214:3
#11 0x00005626c5c3ccda
llvm::ConstantAggrKeyType<llvm::ConstantStruct>::create(llvm::StructType*)
const /SSDATA/llvm-project/llvm/lib/IR/ConstantsContext.h:455:60
#12 0x00005626c5c394ec
llvm::ConstantUniqueMap<llvm::ConstantStruct>::create(llvm::StructType*,
llvm::ConstantAggrKeyType<llvm::ConstantStruct>, std::pair<unsigned int,
std::pair<llvm::StructType*, llvm::ConstantAggrKeyType<llvm::ConstantStruct> >
>&) /SSDATA/llvm-project/llvm/lib/IR/ConstantsContext.h:715:20
#13 0x00005626c5c356f4
llvm::ConstantUniqueMap<llvm::ConstantStruct>::getOrCreate(llvm::StructType*,
llvm::ConstantAggrKeyType<llvm::ConstantStruct>)
/SSDATA/llvm-project/llvm/lib/IR/ConstantsContext.h:734:22
#14 0x00005626c5c25be3 llvm::ConstantStruct::get(llvm::StructType*,
llvm::ArrayRef<llvm::Constant*>)
/SSDATA/llvm-project/llvm/lib/IR/Constants.cpp:1244:67
#15 0x00005626c7072708 (anonymous
namespace)::MicrosoftCXXABI::getAddrOfRTTIDescriptor(clang::QualType)
/SSDATA/llvm-project/clang/lib/CodeGen/MicrosoftCXXABI.cpp:3887:32
#16 0x00005626c707242d (anonymous
namespace)::MicrosoftCXXABI::getAddrOfCXXCatchHandlerType(clang::QualType,
clang::QualType)
/SSDATA/llvm-project/clang/lib/CodeGen/MicrosoftCXXABI.cpp:3848:72
#17 0x00005626c6bfa117
clang::CodeGen::CodeGenFunction::EnterCXXTryStmt(clang::CXXTryStmt const&,
bool) /SSDATA/llvm-project/clang/lib/CodeGen/CGException.cpp:604:43
#18 0x00005626c6bf9f05
clang::CodeGen::CodeGenFunction::EmitCXXTryStmt(clang::CXXTryStmt const&)
/SSDATA/llvm-project/clang/lib/CodeGen/CGException.cpp:576:27
#19 0x00005626c6ca00b9 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
/SSDATA/llvm-project/clang/lib/CodeGen/CGStmt.cpp:188:5
#20 0x00005626c6ca0e96
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
/SSDATA/llvm-project/clang/lib/CodeGen/CGStmt.cpp:418:3
#21 0x00005626c6cc3a41
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
/SSDATA/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1147:36
#22 0x00005626c6cc46c3
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
/SSDATA/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1312:21
#23 0x00005626c6ab6fdb
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/SSDATA/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:4541:3
#24 0x00005626c6aafbac
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/SSDATA/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2901:47
#25 0x00005626c6aaeb72
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
/SSDATA/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2654:5
#26 0x00005626c6abb12c
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.localalias)
/SSDATA/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:5355:37
#27 0x00005626c776c93d (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
/SSDATA/llvm-project/clang/lib/CodeGen/ModuleBuilder.cpp:169:7
#28 0x00005626c77670b6
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
/SSDATA/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:216:7
#29 0x00005626c98d0bbf clang::ParseAST(clang::Sema&, bool, bool)
/SSDATA/llvm-project/clang/lib/Parse/ParseAST.cpp:162:20
#30 0x00005626c75c38a1 clang::ASTFrontendAction::ExecuteAction()
/SSDATA/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1057:11
#31 0x00005626c7764e75 clang::CodeGenAction::ExecuteAction()
/SSDATA/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1183:1
#32 0x00005626c75c3206 clang::FrontendAction::Execute()
/SSDATA/llvm-project/clang/lib/Frontend/FrontendAction.cpp:954:38
#33 0x00005626c7500e15
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/SSDATA/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:984:42
#34 0x00005626c7752f04
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/SSDATA/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:278:38
#35 0x00005626c4d6a0a0 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /SSDATA/llvm-project/clang/tools/driver/cc1_main.cpp:240:40
#36 0x00005626c4d5f9b7 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
/SSDATA/llvm-project/clang/tools/driver/driver.cpp:330:20
#37 0x00005626c4d60168 main
/SSDATA/llvm-project/clang/tools/driver/driver.cpp:407:26
#38 0x00007f45d6bd4002 __libc_start_main (/usr/lib/libc.so.6+0x27002)
#39 0x00005626c4d5e05e _start
(/SSDATA/llvm-project/build/bin/clang-10+0x5fee05e)
clang-10: error: unable to execute command: Aborted (core dumped)
clang-10: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 12.0.0 (https://github.com/llvm/llvm-project.git
ec1445c5afda7f145a414f11c9103c87a4c1823f)
Target: i386-pc-windows-msvc
Thread model: posix
InstalledDir: /SSDATA/llvm-project/build/bin
clang-10: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-10: note: diagnostic msg: /tmp/main-646f71.cpp
clang-10: note: diagnostic msg: /tmp/main-646f71.sh
clang-10: 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/20200731/818546ff/attachment.html>


More information about the llvm-bugs mailing list