From: sje Date: Fri, 7 Oct 2005 17:41:11 +0000 (+0000) Subject: * stor-layout.c (layout_type): Do not allow alignment of array X-Git-Tag: upstream/4.9.2~58286 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b3bb0d2d363e6ba9875a2fa1dc4979e882e977cb;p=platform%2Fupstream%2Flinaro-gcc.git * stor-layout.c (layout_type): Do not allow alignment of array elements to be greater than their size. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105095 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a5f0110..e0930b0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 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 host_xmake_file. (hppa*-*-linux*): Ditto. diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index f7bf20b..aec80a3 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; }