[Bug target/81803] Miscompilation at -O1 on mips64el
james410 at cowgill dot org.uk
gcc-bugzilla@gcc.gnu.org
Thu Aug 10 16:16:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81803
James Cowgill <james410 at cowgill dot org.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |james410 at cowgill dot org.uk
--- Comment #1 from James Cowgill <james410 at cowgill dot org.uk> ---
Created attachment 41966
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41966&action=edit
testcase-b
Here's another testcase which is reduced a bit further using creduce. It
requires -O2 to trigger the bug (but that may be unrelated).
Compile using:
> mips64el-linux-gnuabi64-g++ -g -O2 -fstack-protector-strong -c -o test.o test.c
mips64el-linux-gnuabi64-objdump -dr test.o:
> 98: 8c420000 lw v0,0(v0)
> 9c: 0002102b sltu v0,zero,v0
> a0: afa20008 sw v0,8(sp)
> a4: df990000 ld t9,0(gp)
> a4: R_MIPS_CALL16 _Z19aa_policy_cache_newPiiiis
> a4: R_MIPS_NONE *ABS*
> a4: R_MIPS_NONE *ABS*
> a8: dfa80008 ld a4,8(sp)
> ac: 00003825 move a3,zero
> b0: 00003025 move a2,zero
> b4: 00002825 move a1,zero
> b8: 0320f809 jalr t9
> b8: R_MIPS_JALR _Z19aa_policy_cache_newPiiiis
> b8: R_MIPS_NONE *ABS*
> b8: R_MIPS_NONE *ABS*
Here, the value calculated in v0 is stored to the stack in 8(sp) using sw, but
then loaded later using ld.
More information about the Gcc-bugs
mailing list