diff options
author | Steve Ellcey <sje@cup.hp.com> | 2005-10-07 17:41:11 +0000 |
---|---|---|
committer | Steve Ellcey <sje@gcc.gnu.org> | 2005-10-07 17:41:11 +0000 |
commit | 002a9071e6fe429c55e02c5b678b4e47282d05ca (patch) | |
tree | 65492428572aa8a26cbea7399925a6e16df68518 | |
parent | 79a1aca79799abe989b78a732148f29767af29dc (diff) | |
download | gcc-002a9071e6fe429c55e02c5b678b4e47282d05ca.zip gcc-002a9071e6fe429c55e02c5b678b4e47282d05ca.tar.gz gcc-002a9071e6fe429c55e02c5b678b4e47282d05ca.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/stor-layout.c | 6 |
2 files changed, 11 insertions, 0 deletions
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 <sje@cup.hp.com> + * stor-layout.c (layout_type): Do not allow alignment of array + elements to be greater than their size. + +2005-10-07 Steve Ellcey <sje@cup.hp.com> + * 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; } |