From bf4ccdd6826b5f461cd8b90f5b9706d5d5c5616c Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 10 Aug 2004 21:00:04 -0700 Subject: [PATCH] stor-layout.c (round_up): Check for 0/1 before dividing. * stor-layout.c (round_up): Check for 0/1 before dividing. (round_down): Likewise. From-SVN: r85792 --- gcc/ChangeLog | 3 +++ gcc/stor-layout.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0c7b2e7f934..a51da9b7310 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,8 @@ 2004-08-10 Richard Henderson + * stor-layout.c (round_up): Check for 0/1 before dividing. + (round_down): Likewise. + * tree-tailcall.c (suitable_for_tail_opt_p): Also check DECL_EXTERNAL. 2004-08-09 Mark Mitchell 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)) { -- 2.30.2