[Bug target/84790] Miscompilation for MIPS16 with -fpic and -Os or -O2

2024-05-25 Thread mschiffer--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84790 --- Comment #7 from Matthias Schiffer --- (In reply to YunQiang Su from comment #6) > The attached patch cannot work now. > > It is not correct, and it happened work due to good luck that the same > register was allocated for these 2 instruction

[Bug target/84790] Miscompilation for MIPS16 with -fpic and -Os or -O2

2024-05-26 Thread mschiffer--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84790 --- Comment #10 from Matthias Schiffer --- (In reply to YunQiang Su from comment #8) > Ohh, In fact we should use $28 if TARGET_USE_GOT. > > Can you help to test this patch? > > ``` > diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.

[Bug target/84790] Miscompilation for MIPS16 with -fpic and -Os or -O2

2024-05-27 Thread mschiffer--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84790 --- Comment #13 from Matthias Schiffer --- I don't think the register used matters - changing it may hide the bug in specific instances, but it does not fix the root cause. I've now built a simpler reproducer which still seems to exhibit the sa

[Bug target/84790] Miscompilation for MIPS16 with -fpic and -Os or -O2

2024-05-29 Thread mschiffer--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84790 --- Comment #17 from Matthias Schiffer --- I have now verified replacing Felix's patch with your new patch in the OpenWrt toolchain (currently based on GCC 13.3) results in correct compilation, while a GCC 13.3 without these patches applied exhib