[gcc r12-11151] function: Call do_pending_stack_adjust in assign_parms [PR117296]
Jakub Jelinek
jakub@gcc.gnu.org
Fri Jun 13 15:40:20 GMT 2025
https://gcc.gnu.org/g:6c30e3a9b3db47161fad9d1e13a06977a47fb9d3
commit r12-11151-g6c30e3a9b3db47161fad9d1e13a06977a47fb9d3
Author: Jakub Jelinek <jakub@redhat.com>
Date: Wed Oct 30 09:59:22 2024 +0100
function: Call do_pending_stack_adjust in assign_parms [PR117296]
Functions called by assign_parms call emit_block_move in two places,
so on some targets can be expanded as calls and can result in pending
stack adjustment.
Now, during expansion we normally call do_pending_stack_adjust at the end
of expansion of each basic block or before emitting code that will branch
and/or has labels, and when emitting labels we assert that there are no
pending stack adjustments.
assign_parms is expanded before the first basic block and if the first
basic block starts with a label and at least one of those emit_block_move
calls resulted in the need of pending stack adjustments, we ICE when
emitting that label.
The following patch fixes that by calling do_pending_stack_adjust after
after the assign_parms potential emit_block_move calls.
2024-10-30 Jakub Jelinek <jakub@redhat.com>
PR target/117296
* function.cc (assign_parms): Call do_pending_stack_adjust.
* gcc.target/i386/pr117296.c: New test.
(cherry picked from commit fccef0c4ed0119ac53940bdb3838052339cf14a2)
Diff:
---
gcc/function.cc | 2 ++
gcc/testsuite/gcc.target/i386/pr117296.c | 12 ++++++++++++
2 files changed, 14 insertions(+)
diff --git a/gcc/function.cc b/gcc/function.cc
index d84a3240ee1a..1c564b9167cb 100644
--- a/gcc/function.cc
+++ b/gcc/function.cc
@@ -3724,6 +3724,8 @@ assign_parms (tree fndecl)
now that all parameters have been copied out of hard registers. */
emit_insn (all.first_conversion_insn);
+ do_pending_stack_adjust ();
+
/* Estimate reload stack alignment from scalar return mode. */
if (SUPPORTS_STACK_ALIGNMENT)
{
diff --git a/gcc/testsuite/gcc.target/i386/pr117296.c b/gcc/testsuite/gcc.target/i386/pr117296.c
new file mode 100644
index 000000000000..1b4f6e806913
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr117296.c
@@ -0,0 +1,12 @@
+/* PR target/117296 */
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+/* { dg-additional-options "-mtune=k6 -mstringop-strategy=libcall -ffloat-store" { target ia32 } } */
+
+int x;
+
+void
+foo (_Complex double c)
+{
+ lab:;
+}
More information about the Gcc-cvs
mailing list