aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-08-10 21:00:04 -0700
committerRichard Henderson <rth@gcc.gnu.org>2004-08-10 21:00:04 -0700
commitbf4ccdd6826b5f461cd8b90f5b9706d5d5c5616c (patch)
tree51a03f38c0adf1d6eab2908be51f76a8b85adbfb /gcc
parent7109c195f0703e6fa8c44a774cfcaadacf4fe751 (diff)
downloadgcc-bf4ccdd6826b5f461cd8b90f5b9706d5d5c5616c.zip
gcc-bf4ccdd6826b5f461cd8b90f5b9706d5d5c5616c.tar.gz
gcc-bf4ccdd6826b5f461cd8b90f5b9706d5d5c5616c.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog3
-rw-r--r--gcc/stor-layout.c10
2 files changed, 13 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0c7b2e7..a51da9b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,8 @@
2004-08-10 Richard Henderson <rth@redhat.com>
+ * 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 <mark@codesourcery.com>
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 7721770..3a0acd7 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))
{