pdp11: Fix epilogue generation [PR107841]

gcc/

	PR target/107841
	* config/pdp11/pdp11.cc (pdp11_expand_epilogue): Also
	deallocate alloca-only frame.

gcc/testsuite/

	PR target/107841
	* gcc.target/pdp11/pr107841.c: New test.
This commit is contained in:
Mikael Pettersson 2023-07-13 16:06:39 -04:00 committed by Paul Koning
parent ae862e0e47
commit 8f1a26ee25
2 changed files with 13 additions and 1 deletions

View file

@ -393,7 +393,7 @@ pdp11_expand_epilogue (void)
rtx x, reg, via_ac = NULL;
/* Deallocate the local variables. */
if (fsize)
if (fsize || cfun->calls_alloca)
{
if (frame_pointer_needed)
{

View file

@ -0,0 +1,12 @@
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* Verify that the stack frame is deallocated using the frame pointer. */
void qq (int a)
{
char *s = __builtin_alloca (128);
__builtin_sprintf (s, "qq %d", 3);
}
/* { dg-final { scan-assembler "mov\tr5,sp" } } */