Created attachment 59782 [details] Reduced C test case from cmpdi-1.c There is yet another fail with -mlra with the attached cmpdi-1.c that produces wrong code. $avr-gcc -mmcu=atmega128 -dumpbase "" -save-temps -dp -Os -o cmpdi-1.elf -mlra -fverbose-asm cmpdi-1.c Notice the following load / stores involving Y+12 and X+12 in cmpdi-1.s: std Y+13,r25 ; %sfp, _51 ; 685 [c=4 l=2] *movhi/3 std Y+12,r24 ; %sfp, _51 ... std Y+12,r25 ; %sfp, tmp162 ; 588 [c=4 l=2] *movhi/3 std Y+11,r24 ; %sfp, tmp162 ... std Y+11,r24 ; %sfp, arg1 ; 615 [c=4 l=1] movqi_insn/2 ... ldd r16,Y+11 ; , %sfp ; 640 [c=4 l=1] movqi_insn/3 ... std Y+12,r9 ; %sfp, res ; 439 [c=4 l=2] *movhi/3 std Y+11,r8 ; %sfp, res ... ldd r24,Y+12 ; _51, %sfp ; 435 [c=8 l=2] *movhi/2 ldd r25,Y+13 ; _51, %sfp So it seems LRA is trampling some values / is using wrong offsets. Target: avr Configured with: ../../source/gcc-master/configure --target=avr --disable-nls --with-dwarf2 --with-gnu-as --with-gnu-ld --with-long-double=64 --enable-languages=c,c++ Thread model: single Supported LTO compression algorithms: zlib gcc version 15.0.0 20241203 (experimental) (GCC)
(In reply to Georg-Johann Lay from comment #0) > ...involving Y+12 and X+12 in cmpdi-1.s Meant "Y+12 and Y+11".
Dup *** This bug has been marked as a duplicate of bug 117868 ***