PATCH: Limit array element alignment to less than size.
Mark Mitchell
mark@codesourcery.com
Sat Oct 1 04:46:00 GMT 2005
Steve Ellcey wrote:
> + if (TYPE_SIZE_UNIT (element)
> + && host_integerp (TYPE_SIZE_UNIT (element), 1)
> + && tree_low_cst (TYPE_SIZE_UNIT (element), 1) > 0
> + && (HOST_WIDE_INT) TYPE_ALIGN_UNIT (element)
> + > tree_low_cst (TYPE_SIZE_UNIT (element), 1))
> + error ("alignment of array elements is greater than element size");
Why do this arithmetic using HOST_WIDE_INTs?
Won't this work:
if (TREE_CODE (TYPE_SIZE_UNIT (element)) == INTEGER_CST
&& TREE_CODE (TYPE_ALIGN_UNIT (element)) == INTEGER_CST
&& int_cst_lt (TYPE_SIZE_UNIT (element), TYPE_ALIGN_UNIT (element))
error (...)
If that works, that patch is approved.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304
More information about the Gcc-patches
mailing list