ConstantArrayType's size is not always of pointer width

Hi,

Not sure if this is intentional or not, but ConstantArrayType's Size member is an APInt that doesn't always have pointer width.

Hmm ... looking at the code that creates the type (SemaType.cpp:391), the array size is in fact always 32 bits wide. This definitely looks like a bug.

Am I correct? Should the array size always be pointer width? At least Analysis/RegionStoreManager made this assumption, causing a failing assertion in the Analysis/array-struct.c test case.

Sebastian

No, it's not; it's just using the width of the constant for the array
size; isIntegerConstantExpr overwrites the given width.

-Eli

Eli Friedman wrote:

It'll ultimately be allocated that way, but casting doesn't really
seem necessary; we definitely don't want to truncate the size.

-Eli

Eli Friedman wrote: