"Fu, Chao-Ying" <f...@mips.com> writes: > Hi, > > G++ could not split restore_gp. > Please check this test (from #line 15017 "configure" of > gcc/libstdc++-v3/). > > # cat foo.cpp > struct S { ~S(); }; > void bar(); > void foo() > { > S s; > bar(); > } > > # ~/dev/gcc45/build/gcc/cc1plus -quiet foo.cpp -o foo.s -mno-shared -mplt > -mabicalls -G0 > foo.cpp: In function â?~foo()â?T: > foo.cpp:7:1: error: could not split insn > (insn 29 28 30 (parallel [ > (set (reg:SI 28 $28) > (unspec_volatile:SI [ > (const_int 0 [0x0]) > ] 7)) > (clobber (reg:SI 2 $2)) > ]) 555 {restore_gp} (nil)) > foo.cpp:7:1: internal compiler error: in final_scan_insn, at final.c:2651 > Please submit a full bug report, > with preprocessed source if appropriate. > See <http://gcc.gnu.org/bugs.html> for instructions. > > -------------- > > Something may be wrong before we reach the "final" pass. > (Or, we should have split restore_gp earlier.) > Any idea? Thanks!
It's another case of splits-to-nothing being misinterpreted as failed splits. The patch below fixes the testcase, and although this particular testcase probably passes on 4.4, the same patch is needed there. I'll test it over the next few days. Richard Index: gcc/config/mips/mips.c =================================================================== --- gcc/config/mips/mips.c (revision 153036) +++ gcc/config/mips/mips.c (working copy) @@ -9533,7 +9533,10 @@ gcc_assert (TARGET_ABICALLS && TARGET_OLDABI && epilogue_completed); if (!cfun->machine->must_restore_gp_when_clobbered_p) - return; + { + emit_note (NOTE_INSN_DELETED); + return; + } if (TARGET_MIPS16) {