aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSteve Ellcey <sje@cup.hp.com>2005-10-07 17:41:11 +0000
committerSteve Ellcey <sje@gcc.gnu.org>2005-10-07 17:41:11 +0000
commit002a9071e6fe429c55e02c5b678b4e47282d05ca (patch)
tree65492428572aa8a26cbea7399925a6e16df68518 /gcc
parent79a1aca79799abe989b78a732148f29767af29dc (diff)
downloadgcc-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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/stor-layout.c6
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;
}