aboutsummaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
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/stor-layout.c
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/stor-layout.c')
-rw-r--r--gcc/stor-layout.c6
1 files changed, 6 insertions, 0 deletions
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;
}