<div dir="ltr">Hi,<div><br></div><div>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</div>
<div><br></div><div>struct v {</div><div> int x:9;</div><div> ....</div><div>};</div><div>struct v var1 = {.x=0};</div><div style>struct v var2;</div><div><br></div><div>The LLVM IR generated will declare variable var1 of an anonymous type instead of type struct v, while var2 is okay. </div>
<div><br></div><div><div>%struct.v = type { [2 x i8], [6 x i8] }</div><div>@var1 = global { i8, i8, [6 x i8] } { i8 0, i8 0, [6 x i8] undef }, align 8<br></div></div><div>@var2 = common global %struct.v zeroinitializer, align 8<br>
</div><div><br></div><div>This actually happens always when the variable is statically initialized, and the bitfield is longer than 8 bits.</div><div><br></div><div>Does anyone have any idea why this is occurring, or more exactly where the code responsible for generating this part is?<br clear="all">
<div><br></div>-- <br><div dir="ltr"><div>Sincerely, </div>Razvan Ghitulete<br><br></div>
</div></div>