[llvm-commits] [127801] When an LLVM type has struct padding that overlaps with important fields of

Duncan Sands baldrick at free.fr
Fri Jun 1 13:03:12 PDT 2007


Hi Chris,

> Okay, do you have a testcase that demonstrates this?

I will synthesize one for you.

> Also, the code for handling "large arrays" isn't needed.  This code  
> is only called for fixed size structures that are small.

Hey, you are the one who used getInt64 to get the array length! :)
Another point to consider is that this call could barf:
	unsigned EltSizeBits = TREE_INT_CST_LOW(TYPE_SIZE(TREE_TYPE(type)));
This can happen if the array is a zero length array with an element
type of variable size (meaning the array has length zero).  I reckon the
best thing to do is to bail out early if the type has zero size.
I've attached a new patch.

Ciao,

Duncan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: union_fix.diff
Type: text/x-diff
Size: 1866 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070601/2ccd7d5d/attachment.diff>


More information about the llvm-commits mailing list