[cfe-dev] Struct initializer creating anon type
Ghitulete Razvan
razvan.ghitulete at gmail.com
Wed Jul 30 14:08:48 PDT 2014
Hi,
I have an llvm pass, that goes through all the GlobalVariable objects
inside a file and tries to match them to the corresponding type (at some
point). And I have noticed the following behavior. For
struct v {
int x:9;
....
};
struct v var1 = {.x=0};
struct v var2;
The LLVM IR generated will declare variable var1 of an anonymous type
instead of type struct v, while var2 is okay.
%struct.v = type { [2 x i8], [6 x i8] }
@var1 = global { i8, i8, [6 x i8] } { i8 0, i8 0, [6 x i8] undef }, align 8
@var2 = common global %struct.v zeroinitializer, align 8
This actually happens always when the variable is statically initialized,
and the bitfield is longer than 8 bits.
Does anyone have any idea why this is occurring, or more exactly where the
code responsible for generating this part is?
--
Sincerely,
Razvan Ghitulete
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140730/9505bb1b/attachment.html>
More information about the cfe-dev
mailing list