stor-layout.c (round_up): Check for 0/1 before dividing.
authorRichard Henderson <rth@redhat.com>
Wed, 11 Aug 2004 04:00:04 +0000 (21:00 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 11 Aug 2004 04:00:04 +0000 (21:00 -0700)
        * stor-layout.c (round_up): Check for 0/1 before dividing.
        (round_down): Likewise.

From-SVN: r85792

gcc/ChangeLog
gcc/stor-layout.c

index 0c7b2e7f934c49ac04cc0580784111bbba637906..a51da9b7310715a0e286b89599700e6c937ec605 100644 (file)
@@ -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>
index 772177077f2b10041c163f54ed5bad74cd76cbf7..3a0acd7072597b9e3fa81e020675fdd5df1eba9a 100644 (file)
@@ -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))
     {