[Bug target/106609] [SH] miscompilation due to incorrect elimination of comparisons to 0
mikpelinux at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Aug 17 16:51:58 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106609
Mikael Pettersson <mikpelinux at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikpelinux at gmail dot com
--- Comment #7 from Mikael Pettersson <mikpelinux at gmail dot com> ---
I can reproduce with gcc-12 as host compiler, but not with gcc-11 as host
compiler.
I'm using the example in comment #4, and a recent HEAD of master (bac07a1da24)
configured with --target=sh3eb-elf.
With "GCC: (GNU) 11.3.1 20220812" as host compiler, the cross-compiler compiles
(-O1) the example to:
_f:
cmp/pz r4
bf.s .L3
add r4,r5
tst r5,r5
bf .L4
rts
mov r4,r0
.align 1
.L3:
rts
mov #1,r0
.align 1
.L4:
rts
mov #3,r0
which looks ok to me (not knowing SH asm...).
With "GCC: (GNU) 12.1.1 20220812" (the 12.2.0 RC) as host compiler, the
cross-compiler instead compiles the example to:
_f:
cmp/pz r4
bf .L3
bf .L4
rts
mov r4,r0
.align 1
.L3:
rts
mov #1,r0
.align 1
.L4:
rts
mov #3,r0
which looks broken.
More information about the Gcc-bugs
mailing list