https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91769
Bug ID: 91769
Summary: [9 regression] wrong code with -O2 on MIPS
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: aurelien at aurel32 dot net
Target Milestone: ---
Host: mipsel-unknown-linux-gnu
Target: mipsel-unknown-linux-gnu
Build: mipsel-unknown-linux-gnu
Created attachment 46881
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46881&action=edit
Testcase
GCC 9.2 generates wrong code for the attached testcase file (extracted from
gnuplot and simplified) when compiled with -O2 -march=mips32r2. This doesn't
happen at -O1 level. This also doesn't happen with GCC 8.3. This is however
reproducible with a snapshot of trunk from 2019-08-28.
Here is the relevant part of the generated assembly code:
0x00400780 <+80>: lw v0,8(v1)
0x00400784 <+84>: lw v1,12(v1)
Here v1 is clobbered
0x00400788 <+88>: ldc1 $f2,64(sp)
=> 0x0040078c <+92>: ldc1 $f0,8(v1)
So it crashes when the double value is loaded from the array.