function.c (expand_function_end): If current_function_calls_alloca...
authorBernd Schmidt <bernd.schmidt@analog.com>
Wed, 26 Jan 2005 11:22:33 +0000 (11:22 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Wed, 26 Jan 2005 11:22:33 +0000 (11:22 +0000)
* function.c (expand_function_end): If current_function_calls_alloca,
emit stack restore in a place that is reached when the function falls
through at the end.

From-SVN: r94259

gcc/ChangeLog
gcc/function.c

index 5f17ea21d4bf4b7d3aaf24c784554b8dea5a2cc8..a418bfc6ac551d9bc9a9cee2dc7cd6f45091766f 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-26  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+       * function.c (expand_function_end): If current_function_calls_alloca,
+       emit stack restore in a place that is reached when the function falls
+       through at the end.
+
 2005-01-26  Alexandre Oliva  <aoliva@redhat.com>
 
        * Makefile.in (../$(build_subdir)/fixincludes/fixincl): Add dummy
index f0d2ec1110dd249f3f38a1155ca4f3a154ff3d7d..c4656e53587ca9ca46c69c2bde121936ea827099 100644 (file)
@@ -4460,18 +4460,6 @@ expand_function_end (void)
   if (flag_exceptions && USING_SJLJ_EXCEPTIONS)
     sjlj_emit_function_exit_after (get_last_insn ());
 
-  /* If we had calls to alloca, and this machine needs
-     an accurate stack pointer to exit the function,
-     insert some code to save and restore the stack pointer.  */
-  if (! EXIT_IGNORE_STACK
-      && current_function_calls_alloca)
-    {
-      rtx tem = 0;
-
-      emit_stack_save (SAVE_FUNCTION, &tem, parm_birth_insn);
-      emit_stack_restore (SAVE_FUNCTION, tem, NULL_RTX);
-    }
-
   /* If scalar return value was computed in a pseudo-reg, or was a named
      return value that got dumped to the stack, copy that to the hard
      return register.  */
@@ -4599,6 +4587,18 @@ expand_function_end (void)
   /* Output the label for the naked return from the function.  */
   emit_label (naked_return_label);
 
+  /* If we had calls to alloca, and this machine needs
+     an accurate stack pointer to exit the function,
+     insert some code to save and restore the stack pointer.  */
+  if (! EXIT_IGNORE_STACK
+      && current_function_calls_alloca)
+    {
+      rtx tem = 0;
+
+      emit_stack_save (SAVE_FUNCTION, &tem, parm_birth_insn);
+      emit_stack_restore (SAVE_FUNCTION, tem, NULL_RTX);
+    }
+
   /* ??? This should no longer be necessary since stupid is no longer with
      us, but there are some parts of the compiler (eg reload_combine, and
      sh mach_dep_reorg) that still try and compute their own lifetime info