https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116374
Bug ID: 116374
Summary: [LRA] [M68K] Wrong %argptr elimination
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Blocks: 113939
Target Milestone: ---
$ cat argptr.c
void
bar (void *p, int size)
{
__builtin_strncpy (p, "good", size);
}
With LRA and -fpic -O we generate:
bar:
move.l %a5,-(%sp)
lea (%pc, _GLOBAL_OFFSET_TABLE_@GOTPC), %a5
move.l 12(%sp),-(%sp)
move.l [email protected](%a5),-(%sp)
move.l 8(%sp),-(%sp)
bsr.l strncpy@PLTPC
lea (12,%sp),%sp
move.l (%sp)+,%a5
rts
where 8(%sp) should be 16(%sp).
This is
(insn 10 9 11 2 (set (mem/f:SI (pre_dec:SI (reg/f:SI 15 %sp)) [1 S4 A16])
(mem/f/c:SI (plus:SI (reg/f:SI 24 %argptr)
(const_int 8 [0x8])) [1 p+0 S4 A32])) "argptr.c":4:3 55
{*movsi_m68k2}
(expr_list:REG_ARGS_SIZE (const_int 12 [0xc])
(nil)))
before reload.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113939
[Bug 113939] Switch m68k to LRA