On 7/7/2026 2:09 PM, Mikael Pettersson wrote:
Since gcc-15 combine can produce moves from an auto-inc/dec source to
a destination that uses the same register, causing wrong code on m68k.
Both glibc and Python are known to be miscompiled due to this.
This adjusts the m68k backend to reject such moves.
For glibc the difference is
- move.l -(%a0),(%a0,%d0.l)
+ lea (%a0,%d0.l),%a1
+ move.l -(%a0),(%a1)
Python has a similar problem, but with a post-inc source operand.
Bootstrapped and regression tested on m68k-linux-gnu, no regressions.
Ok for trunk? And maybe gcc-16/15 after a week?
gcc/
2026-07-07 Mikael Pettersson <[email protected]>
PR rtl-optimization/123853
PR target/123076
* config/m68k/m68k-protos.h (check_move_simode): Declare.
* config/m68k/m68k.cc (check_move_simode): New, reject move from
auto-inc/dec source mem whose reg occurs in the destination address.
* config/m68k/m68k.md (*movsi_m68k): Add check_move_simode to
condition.
(*movsi_m68k2): Likewise.
Sorry, no. I think this is fundamentally the wrong way to go. As I
outlined elsewhere, the right way to go is the dynamic filtering.
Jeff