function.c (assign_stack_local_1): Issue an error message if the frame size overflows...
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 9 Nov 2005 23:28:59 +0000 (23:28 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 9 Nov 2005 23:28:59 +0000 (23:28 +0000)
* function.c (assign_stack_local_1): Issue an error message if
the frame size overflows in the signed target arithmetics.

From-SVN: r106717

gcc/ChangeLog
gcc/function.c

index b3e05f39c125c6509cb8b8f62e9a3a40eff0581a..ea2215066103c50b956f95b2a7271002e255992a 100644 (file)
@@ -1,3 +1,8 @@
+2005-11-09  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * function.c (assign_stack_local_1): Issue an error message if
+       the frame size overflows in the signed target arithmetics.
+
 2005-11-09  Eric Botcazou  <ebotcazou@adacore.com>
 
        * tree.c (build_qualified_type): Chain the new type to the original
index 9e36af74d72344d9cb3c33eae0a3285e5c44d13a..963ad4f1e94d7d72ebf5cd79a6251b4b738b4c7f 100644 (file)
@@ -479,6 +479,19 @@ assign_stack_local_1 (enum machine_mode mode, HOST_WIDE_INT size, int align,
   function->x_stack_slot_list
     = gen_rtx_EXPR_LIST (VOIDmode, x, function->x_stack_slot_list);
 
+  /* Try to detect frame size overflows.  */
+  if ((FRAME_GROWS_DOWNWARD
+       ? (unsigned HOST_WIDE_INT) -function->x_frame_offset
+       : (unsigned HOST_WIDE_INT) function->x_frame_offset)
+       > ((unsigned HOST_WIDE_INT) 1 << (BITS_PER_WORD - 1))
+           /* Leave room for the fixed part of the frame.  */
+           - 64 * UNITS_PER_WORD)
+    {
+      error ("%Jtotal size of local objects too large", function->decl);
+      /* Avoid duplicate error messages as much as possible.  */
+      function->x_frame_offset = 0;
+    }
+
   return x;
 }