Skip to content

Crash on index into zero element struct #4116

@llvmbot

Description

@llvmbot
Bugzilla Link 3744
Resolution FIXED
Resolved on Mar 09, 2009 00:46
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor

Extended Description

This code is causing problems:

$ cat t2.i
struct Empty {};
struct Union {
union {
int zero_arr[0];
} contents;
};
static inline void Foo(struct Union *u) {
int *array = u->contents.zero_arr;
}
static void Bar(struct Union *u) {
Foo(u);
}

$ llvm-gcc -c t2.i
Assertion failed: (MemberIndex < StructTy->getNumContainedTypes() && "Field Idx out of range!"), function EmitLV_COMPONENT_REF, file ../../llvm-gcc.src/gcc/llvm-convert.cpp, line 5993.
t2.i: In function ‘Foo’:
t2.i:7: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See URL:http://developer.apple.com/bugreporter for instructions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzilla

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions