[llvm-bugs] [Bug 35130] New: clang crashes on x86_64-linux-gnu with Assertion `V.size() == T->getNumElements() && "Invalid initializer for constant array"' failed.
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Oct 29 22:51:06 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=35130
Bug ID: 35130
Summary: clang crashes on x86_64-linux-gnu with Assertion
`V.size() == T->getNumElements() && "Invalid
initializer for constant array"' failed.
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: helloqirun at gmail.com
CC: llvm-bugs at lists.llvm.org
It affects all clang versions from 3.6 to trunk. I did not test any earlier
version.
$ clang-trunk -v
clang version 6.0.0 (trunk 316860)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
$ clang-trunk abc.c
clang-6.0: /home/absozero/trunk/llvm/lib/IR/Constants.cpp:885:
llvm::ConstantArray::ConstantArray(llvm::ArrayType*,
llvm::ArrayRef<llvm::Constant*>): Assertion `V.size() == T->getNumElements() &&
"Invalid initializer for constant array"' failed.
#0 0x00000000020c2eca llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x20c2eca)
#1 0x00000000020c0d6e llvm::sys::RunSignalHandlers()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x20c0d6e)
#2 0x00000000020c0ec2 SignalHandler(int)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x20c0ec2)
#3 0x00007fa921c5b330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007fa9207d8c37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007fa9207dc028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007fa9207d1bf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#7 0x00007fa9207d1ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x0000000001b554f8 (/home/absozero/trunk/root-clang/bin/clang-6.0+0x1b554f8)
#9 0x0000000001b605c0
llvm::ConstantUniqueMap<llvm::ConstantArray>::getOrCreate(llvm::ArrayType*,
llvm::ConstantAggrKeyType<llvm::ConstantArray>)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1b605c0)
#10 0x0000000001b607ab llvm::ConstantArray::get(llvm::ArrayType*,
llvm::ArrayRef<llvm::Constant*>)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1b607ab)
#11 0x0000000002299afb clang::StmtVisitorBase<clang::make_ptr, (anonymous
namespace)::ConstExprEmitter, llvm::Constant*,
clang::QualType>::Visit(clang::Stmt*, clang::QualType)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2299afb)
#12 0x00000000022979d3
clang::CodeGen::ConstantEmitter::tryEmitPrivate(clang::Expr const*,
clang::QualType) (/home/absozero/trunk/root-clang/bin/clang-6.0+0x22979d3)
#13 0x0000000002297bb6
clang::CodeGen::ConstantEmitter::tryEmitPrivateForMemory(clang::Expr const*,
clang::QualType) (/home/absozero/trunk/root-clang/bin/clang-6.0+0x2297bb6)
#14 0x0000000002299721 clang::StmtVisitorBase<clang::make_ptr, (anonymous
namespace)::ConstExprEmitter, llvm::Constant*,
clang::QualType>::Visit(clang::Stmt*, clang::QualType)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2299721)
#15 0x0000000002299d49
clang::CodeGen::ConstantEmitter::tryEmitPrivateForVarInit(clang::VarDecl
const&) (/home/absozero/trunk/root-clang/bin/clang-6.0+0x2299d49)
#16 0x0000000002299e52
clang::CodeGen::ConstantEmitter::tryEmitAbstractForInitializer(clang::VarDecl
const&) (/home/absozero/trunk/root-clang/bin/clang-6.0+0x2299e52)
#17 0x00000000023feab8
clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission
const&) (/home/absozero/trunk/root-clang/bin/clang-6.0+0x23feab8)
#18 0x0000000002402772
clang::CodeGen::CodeGenFunction::EmitAutoVarDecl(clang::VarDecl const&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2402772)
#19 0x0000000002402856
clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2402856)
#20 0x0000000002402bd4 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl
const&) (/home/absozero/trunk/root-clang/bin/clang-6.0+0x2402bd4)
#21 0x00000000022a6faf
clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x22a6faf)
#22 0x00000000022b41a2
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x22b41a2)
#23 0x00000000022aff70 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x22aff70)
#24 0x00000000022b111b
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x22b111b)
#25 0x00000000022e5230
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) (/home/absozero/trunk/root-clang/bin/clang-6.0+0x22e5230)
#26 0x00000000022f206e
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x22f206e)
#27 0x0000000002311198
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/home/absozero/trunk/root-clang/bin/clang-6.0+0x2311198)
#28 0x0000000002321d07
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/home/absozero/trunk/root-clang/bin/clang-6.0+0x2321d07)
#29 0x0000000002322b5a
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2322b5a)
#30 0x000000000232334a
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) [clone
.part.6149] [clone .constprop.6154]
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x232334a)
#31 0x0000000002a96e6b (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2a96e6b)
#32 0x0000000002a8dbeb
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2a8dbeb)
#33 0x0000000002c75726 clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2c75726)
#34 0x0000000002a9475c clang::CodeGenAction::ExecuteAction()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2a9475c)
#35 0x000000000262977e clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x262977e)
#36 0x00000000025f8be6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x25f8be6)
#37 0x00000000026bc2c3
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x26bc2c3)
#38 0x0000000000a52c08 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang-6.0+0xa52c08)
#39 0x00000000009cf145 main
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x9cf145)
#40 0x00007fa9207c3f45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#41 0x0000000000a4f119 _start
(/home/absozero/trunk/root-clang/bin/clang-6.0+0xa4f119)
Stack dump:
0. Program arguments: /home/absozero/trunk/root-clang/bin/clang-6.0 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name abc.c -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info
-debugger-tuning=gdb -resource-dir
/home/absozero/trunk/root-clang/lib/clang/6.0.0 -internal-isystem
/usr/local/include -internal-isystem
/home/absozero/trunk/root-clang/lib/clang/6.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir /home/absozero/projects/reduction/crash -ferror-limit
19 -fmessage-length 172 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/abc-7b2ab8.o -x c abc.c
1. <eof> parser at end of file
2. abc.c:1:6: LLVM IR generation of declaration 'fn1'
3. abc.c:1:6: Generating code for declaration 'fn1'
clang-6.0: error: unable to execute command: Aborted (core dumped)
clang-6.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 6.0.0 (trunk 316860)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-6.0: 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-6.0: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-6.0: note: diagnostic msg: /tmp/abc-172b9f.c
clang-6.0: note: diagnostic msg: /tmp/abc-172b9f.sh
clang-6.0: note: diagnostic msg:
********************
$ cat abc.c
void fn1() { int a[][4430235014][1] = {{{3}}}; }
--
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/20171030/6dea9a2a/attachment-0001.html>
More information about the llvm-bugs
mailing list