aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/calls.cc9
-rw-r--r--gcc/testsuite/g++.dg/other/pr104989.C9
2 files changed, 17 insertions, 1 deletions
diff --git a/gcc/calls.cc b/gcc/calls.cc
index 50fa7b8..e13469c 100644
--- a/gcc/calls.cc
+++ b/gcc/calls.cc
@@ -3068,6 +3068,7 @@ expand_call (tree exp, rtx target, int ignore)
for (pass = try_tail_call ? 0 : 1; pass < 2; pass++)
{
int sibcall_failure = 0;
+ bool normal_failure = false;
/* We want to emit any pending stack adjustments before the tail
recursion "call". That way we know any adjustment after the tail
recursion call can be ignored if we indeed use the tail
@@ -3448,7 +3449,10 @@ expand_call (tree exp, rtx target, int ignore)
{
sorry ("passing too large argument on stack");
/* Don't worry about stack clean-up. */
- flags |= ECF_NORETURN;
+ if (pass == 0)
+ sibcall_failure = 1;
+ else
+ normal_failure = true;
continue;
}
@@ -3905,9 +3909,12 @@ expand_call (tree exp, rtx target, int ignore)
/* Verify that we've deallocated all the stack we used. */
gcc_assert ((flags & ECF_NORETURN)
+ || normal_failure
|| known_eq (old_stack_allocated,
stack_pointer_delta
- pending_stack_adjust));
+ if (normal_failure)
+ normal_call_insns = NULL;
}
/* If something prevents making this a sibling call,
diff --git a/gcc/testsuite/g++.dg/other/pr104989.C b/gcc/testsuite/g++.dg/other/pr104989.C
new file mode 100644
index 0000000..8b1f79b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/pr104989.C
@@ -0,0 +1,9 @@
+// PR rtl-optimization/104989
+// { dg-do compile }
+// { dg-options "-fnon-call-exceptions" }
+
+struct a {
+ short b : -1ULL;
+};
+void c(...) { c(a()); }
+// { dg-excess-errors "" }