[LLVMbugs] [Bug 1923] New: clang: Assertion `V.size() == T->getNumElements() && " Invalid initializer vector for constant structure"'

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Jan 18 02:52:43 PST 2008


http://llvm.org/bugs/show_bug.cgi?id=1923

           Summary: clang: Assertion `V.size() == T->getNumElements() &&
                    "Invalid initializer vector for constant structure"'
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: LLVM Codegen
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: edwintorok at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=1341)
 --> (http://llvm.org/bugs/attachment.cgi?id=1341)
delta reduced testcase

Using clang r46160,  codegen fails:

$ clang rtf.i -emit-llvm-bc
clang: Constants.cpp:367: llvm::ConstantStruct::ConstantStruct(const
llvm::StructType*, const std::vector<llvm::Constant*,
std::allocator<llvm::Constant*> >&): Assertion `V.size() == T->getNumElements()
&& "Invalid initializer vector for constant structure"' failed.
clang[0x65292b]
/lib/libc.so.6[0x363d232090]
/lib/libc.so.6(gsignal+0x35)[0x363d232025]
/lib/libc.so.6(abort+0x110)[0x363d233a80]
/lib/libc.so.6(__assert_fail+0xef)[0x363d22b42f]
clang[0x59b37c]
clang(llvm::ConstantStruct::get(llvm::StructType const*,
std::vector<llvm::Constant*, std::allocator<llvm::Constant*> >
const&)+0x1e7)[0x5a5bc7]
clang[0x4a75b0]
clang[0x4a6835]
clang(clang::CodeGen::CodeGenModule::EmitGlobalVar(clang::FileVarDecl
const*)+0x80)[0x4a70a0]
clang(clang::CodeGen::CodeGenModule::EmitGlobalVarDeclarator(clang::FileVarDecl
const*)+0x27)[0x4a72f7]
clang(clang::ParseAST(clang::Preprocessor&, clang::ASTConsumer*,
bool)+0x3f8)[0x4e5fd8]
clang[0x49b009]
clang(main+0x9fa)[0x4a0cfa]
/lib/libc.so.6(__libc_start_main+0xf4)[0x363d21e1c4]
clang[0x481589]
Aborted

The attached testcase gives no warnings with gcc (it could be reduced even
further, but then gcc would give warnings)

I have used the following script as delta's -test parameter:

clang -emit-llvm-bc $1  2>&1 | grep "Invalid initializer vector for constant
structure"

if ! test $? == 0; then
        exit 1
fi
gcc  -Wall -Wfatal-errors -fsyntax-only $1
if ! test $? == 0; then
        exit 1
fi
exit 0


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list