From: Steve Ellcey Date: Fri, 7 Oct 2005 17:41:11 +0000 (+0000) Subject: stor-layout.c (layout_type): Do not allow alignment of array elements to be greater... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=002a9071e6fe429c55e02c5b678b4e47282d05ca;p=gcc.git stor-layout.c (layout_type): Do not allow alignment of array elements to be greater than their size. * stor-layout.c (layout_type): Do not allow alignment of array elements to be greater than their size. From-SVN: r105095 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a5f0110d77b..e0930b0ef7f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-10-07 Steve Ellcey + + * stor-layout.c (layout_type): Do not allow alignment of array + elements to be greater than their size. + 2005-10-07 Steve Ellcey * config.host (hppa*-*-hpux*): Change out_host_hook_obj and diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index f7bf20b03ad..aec80a3f294 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -1817,6 +1817,12 @@ layout_type (tree type) TYPE_MODE (type) = BLKmode; } } + if (TYPE_SIZE_UNIT (element) + && TREE_CODE (TYPE_SIZE_UNIT (element)) == INTEGER_CST + && !integer_zerop (TYPE_SIZE_UNIT (element)) + && compare_tree_int (TYPE_SIZE_UNIT (element), + TYPE_ALIGN_UNIT (element)) < 0) + error ("alignment of array elements is greater than element size"); break; }