https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116429
Bug ID: 116429 Summary: [LRA] [M86k] Wrong spill offset Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: ra, wrong-code Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: sch...@linux-m68k.org Blocks: 113939 Target Milestone: --- Target: m68k Created attachment 58961 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58961&action=edit io.ii $ gcc/xg++ -B gcc/ io.ii -std=gnu++26 -S -O2 -mlra io.ii .L1540: move.l %d2,%d0 and.l 100(%sp),%d0 cmp.l %d0,%d2 jne .L1622 move.l %a0,48(%sp) clr.l -(%sp) .cfi_def_cfa_offset 96 pea 37.w .cfi_def_cfa_offset 100 move.l %a1,-(%sp) .cfi_def_cfa_offset 104 move.l %a2,%d0 sub.l %a1,%d0 .cfi_def_cfa_offset 108 move.l %a1,60(%sp) move.l %d0,-(%sp) jsr (_ZNKSt17basic_string_viewIcSt11char_traitsIcEE4findEcj.isra.0) lea (16,%sp),%sp .cfi_def_cfa_offset 92 move.l 44(%sp),%a1 move.l 48(%sp),%a0 60(%sp) should be 56(%sp), overwriting the value of %a0 at 48(%sp) >From the reload dump: (insn 1033 549 550 122 (set (mem/c:SI (plus:SI (reg/f:SI 15 %sp) (const_int 48 [0x30])) [492 %sfp+-40 S4 A16]) (reg/v/f:SI 8 %a0 [orig:69 __first ] [69])) 55 {*movsi_m68k2} (nil)) (insn 550 1033 551 122 (set (mem:SI (pre_dec:SI (reg/f:SI 15 %sp)) [8 S4 A16]) (const_int 0 [0])) "m68k-linux/libstdc++-v3/include/bits/chrono_io.h":478:68 discrim 1 50 {pushexthisi_const} (expr_list:REG_ARGS_SIZE (const_int 4 [0x4]) (nil))) (insn 551 550 552 122 (set (mem:SI (pre_dec:SI (reg/f:SI 15 %sp)) [8 S4 A16]) (const_int 37 [0x25])) "m68k-linux/libstdc++-v3/include/bits/chrono_io.h":478:68 discrim 1 50 {pushexthisi_const} (expr_list:REG_ARGS_SIZE (const_int 8 [0x8]) (nil))) (insn 552 551 553 122 (set (mem/f:SI (pre_dec:SI (reg/f:SI 15 %sp)) [3 S4 A16]) (reg/f:SI 9 %a1 [orig:37 _19 ] [37])) "m68k-linux/libstdc++-v3/include/bits/chrono_io.h":478:68 discrim 1 55 {*movsi_m68k2} (expr_list:REG_ARGS_SIZE (const_int 12 [0xc]) (nil))) (note 553 552 996 122 NOTE_INSN_DELETED) (insn 996 553 554 122 (set (reg:SI 0 %d0 [262]) (reg/v/f:SI 10 %a2 [orig:116 <retval> ] [116])) "m68k-linux/libstdc++-v3/include/bits/chrono_io.h":478:68 discrim 1 55 {*movsi_m68k2} (nil)) (insn 554 996 1031 122 (set (reg:SI 0 %d0 [262]) (minus:SI (reg:SI 0 %d0 [262]) (reg/f:SI 9 %a1 [orig:37 _19 ] [37]))) "m68k-linux/libstdc++-v3/include/bits/chrono_io.h":478:68 discrim 1 176 {subsi3} (expr_list:REG_ARGS_SIZE (const_int 16 [0x10]) (nil))) (insn 1031 554 997 122 (set (mem/c:SI (plus:SI (reg/f:SI 15 %sp) (const_int 60 [0x3c])) [492 %sfp+-44 S4 A16]) (reg/f:SI 9 %a1 [orig:37 _19 ] [37])) "m68k-linux/libstdc++-v3/include/bits/chrono_io.h":478:68 discrim 1 55 {*movsi_m68k2} (nil)) (insn 997 1031 556 122 (set (mem:SI (pre_dec:SI (reg/f:SI 15 %sp)) [8 S4 A16]) (reg:SI 0 %d0 [262])) "m68k-linux/libstdc++-v3/include/bits/chrono_io.h":478:68 discrim 1 55 {*movsi_m68k2} (nil)) (call_insn/i 556 997 557 122 (set (reg:SI 0 %d0) (call (mem:QI (symbol_ref:SI ("_ZNKSt17basic_string_viewIcSt11char_traitsIcEE4findEcj.isra.0") [flags 0x3] <function_decl 0x7f3905387a00 find.isra>) [0 find.isra S1 A8]) (const_int 16 [0x10]))) "m68k-linux/libstdc++-v3/include/bits/chrono_io.h":478:68 discrim 1 393 {*non_symbolic_call_value} (expr_list:REG_CALL_DECL (symbol_ref:SI ("_ZNKSt17basic_string_viewIcSt11char_traitsIcEE4findEcj.isra.0") [flags 0x3] <function_decl 0x7f3905387a00 find.isra>) (expr_list:REG_EH_REGION (const_int 0 [0]) (nil))) (nil)) (insn 557 556 1032 122 (set (reg/f:SI 15 %sp) (plus:SI (reg/f:SI 15 %sp) (const_int 16 [0x10]))) "m68k-linux/libstdc++-v3/include/bits/chrono_io.h":478:68 discrim 1 150 {*addsi3_internal} (expr_list:REG_ARGS_SIZE (const_int 0 [0]) (nil))) (insn 1032 557 1034 122 (set (reg/f:SI 9 %a1 [orig:37 _19 ] [37]) (mem/c:SI (plus:SI (reg/f:SI 15 %sp) (const_int 44 [0x2c])) [492 %sfp+-44 S4 A16])) "m68k-linux/libstdc++-v3/include/bits/chrono_io.h":479:8 55 {*movsi_m68k2} (nil)) (insn 1034 1032 559 122 (set (reg/v/f:SI 8 %a0 [orig:69 __first ] [69]) (mem/c:SI (plus:SI (reg/f:SI 15 %sp) (const_int 48 [0x30])) [492 %sfp+-40 S4 A16])) "m68k-linux/libstdc++-v3/include/bits/chrono_io.h":479:8 55 {*movsi_m68k2} (nil)) Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113939 [Bug 113939] Switch m68k to LRA