https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101697
Jeffrey A. Law <law at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED Assignee|unassigned at gcc dot gnu.org |law at gcc dot gnu.org Last reconfirmed| |2021-08-17 --- Comment #4 from Jeffrey A. Law <law at gcc dot gnu.org> --- I've managed to reproduce. It's possible I was missing the -fno-builtin on my command line. A much simplified testcase: struct gaih_servtuple { struct gaih_servtuple *next; }; int gaih_inet (const char *name, const void *req) { struct gaih_servtuple *st; int *tp; if (req) ++tp; struct gaih_servtuple **pst = &st; while (1) { struct gaih_servtuple *newp; newp = __builtin_alloca (sizeof (struct gaih_servtuple)); frob (name, tp, req, newp); *pst = newp; pst = &(newp->next); tp++; } } We're fine up to and including IRA. (insn 20 18 22 5 (set (reg/f:SI 28) (reg/f:SI 7 sp)) "k.c":21:14 19 {*movsi} (nil)) (insn 22 20 23 5 (set (mem/f:SI (pre_dec:SI (reg/f:SI 7 sp)) [1 S4 A32]) (reg/f:SI 28)) "k.c":22:7 19 {*movsi} (expr_list:REG_ARGS_SIZE (const_int 4 [0x4]) (nil))) And IRA allocates hard reg #6 for pseudo #28, which is also fine. Reload reports: Reload 1: reload_in (SI) = (reg/f:SI 28) GENERAL_REGS, RELOAD_FOR_INPUT (opnum = 1) reload_in_reg: (reg/f:SI 28) reload_reg_rtx: (reg/f:SI 7 sp) Which is not good as replacing (reg 28) with (reg sp) is not valid. I haven't tried converting the H8 to LRA yet, which would be the ultimate solution if it worked. Ideally any port not converted to LRA ought to be flagged as deprecated for gcc-12 and dropped if not fixed by gcc-13.