summaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-11 04:00:04 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-11 04:00:04 +0000
commitd69167ce95371c38f13fdc562b8d19a13332b4a6 (patch)
tree51a03f38c0adf1d6eab2908be51f76a8b85adbfb /gcc/stor-layout.c
parent2a7b0524c2189793eec7bb5f4915eb03a4bfac5a (diff)
downloadgcc-d69167ce95371c38f13fdc562b8d19a13332b4a6.tar.gz
* stor-layout.c (round_up): Check for 0/1 before dividing.
(round_down): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85792 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 772177077f2..3a0acd70725 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -277,6 +277,11 @@ round_up (tree value, int divisor)
{
tree t;
+ if (divisor == 0)
+ abort ();
+ if (divisor == 1)
+ return value;
+
/* If divisor is a power of two, simplify this to bit manipulation. */
if (divisor == (divisor & -divisor))
{
@@ -302,6 +307,11 @@ round_down (tree value, int divisor)
{
tree t;
+ if (divisor == 0)
+ abort ();
+ if (divisor == 1)
+ return value;
+
/* If divisor is a power of two, simplify this to bit manipulation. */
if (divisor == (divisor & -divisor))
{