diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 283f3372798c84ef74356128acf2a5be7b4ce1ad..d4b13d48d852a70848fc7c51fd867e776efb5e55 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -4050,6 +4050,11 @@ aarch64_layout_frame (void) offset = 2 * UNITS_PER_WORD; } + /* With stack-clash, LR must be saved in non-leaf functions. */ + gcc_assert (crtl->is_leaf + || (cfun->machine->frame.reg_offset[R30_REGNUM] + != SLOT_NOT_REQUIRED)); + /* Now assign stack slots for them. */ for (regno = R0_REGNUM; regno <= R30_REGNUM; regno++) if (cfun->machine->frame.reg_offset[regno] == SLOT_REQUIRED)