https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101697

--- Comment #3 from Mikael Pettersson <mikpelinux at gmail dot com> ---
As far as I can tell the problem is introduced by reload.

With a gcc-11.2.0 cross, getaddrinfo.i.290r.ira has

(insn 161 159 163 31 (set (reg/f:SI 185)
        (reg/f:SI 7 sp)) "libc/inet/getaddrinfo.c":465:13 13 {*movsi}
     (nil))
(insn 163 161 164 31 (set (mem/f:SI (pre_dec:SI (reg/f:SI 7 sp)) [3  S4 A32])
        (reg/f:SI 185)) "libc/inet/getaddrinfo.c":466:11 13 {*movsi}
     (expr_list:REG_ARGS_SIZE (const_int 4 [0x4])
        (nil)))

these are adjacent.

Then getaddrinfo.i.291r.reload has

Reloads for insn # 161
Reload 0: reload_out (SI) = (reg/f:SI 185)
        NO_REGS, RELOAD_FOR_OUTPUT (opnum = 0), optional
        reload_out_reg: (reg/f:SI 185)

Reloads for insn # 163
Reload 0: reload_out (SI) = (mem/f:SI (pre_dec:SI (reg/f:SI 7 sp)) [3  S4 A32])
        NO_REGS, RELOAD_FOR_OUTPUT (opnum = 0), optional
        reload_out_reg: (mem/f:SI (pre_dec:SI (reg/f:SI 7 sp)) [3  S4 A32])
Reload 1: reload_in (SI) = (reg/f:SI 185)
        GENERAL_REGS, RELOAD_FOR_INPUT (opnum = 1)
        reload_in_reg: (reg/f:SI 185)
        reload_reg_rtx: (reg/f:SI 7 sp)

and later

(insn 161 159 995 31 (set (mem/c:SI (plus:SI (reg/f:SI 6 r6)
                (const_int -140 [0xffffffffffffff74])) [30 %sfp+-132 S4 A32])
        (reg/f:SI 7 sp)) "libc/inet/getaddrinfo.c":465:13 13 {*movsi}
     (nil))
(insn 995 161 163 31 (set (reg/f:SI 7 sp)
        (mem/c:SI (plus:SI (reg/f:SI 6 r6)
                (const_int -140 [0xffffffffffffff74])) [30 %sfp+-132 S4 A32]))
"libc/inet/getaddrinfo.c":466:11 13 {*movsi}
     (expr_list:REG_ARGS_SIZE (const_int 0 [0])
        (nil)))
(insn 163 995 164 31 (set (mem/f:SI (pre_dec:SI (reg/f:SI 7 sp)) [3  S4 A32])
        (reg/f:SI 7 sp)) "libc/inet/getaddrinfo.c":466:11 13 {*movsi}
     (expr_list:REG_ARGS_SIZE (const_int 4 [0x4])
        (nil)))

It's strange you can't reproduce. My current build is literally:

> mkdir objdir-binutils; cd objdir-binutils
> /tmp/binutils-2.37/configure --target=h8300-unknown-linux-uclibc 
> --prefix=/tmp/cross-h8300 --with-sysroot=/tmp/cross-h8300
> make -jN
> make install
> cd ..
> mkdir objdir-gcc; cd objdir-gcc
> PATH=/tmp/cross-h8300/bin:/usr/bin /tmp/gcc-11.2.0/configure 
> --target=h8300-unknown-linux-uclibc --prefix=/tmp/cross-h8300 
> --with-sysroot=/tmp/cross-h8300 --with-newlib --disable-libquadmath 
> --disable-libssp --disable-threads --disable-libatomic --disable-libgomp 
> --enable-languages=c --enable-checking=release
> PATH=/tmp/cross-h8300/bin:/usr/bin make -jN
> gcc/xgcc -Bgcc -fno-builtin -Os -S /tmp/getaddrinfo.i

Reply via email to