------- Comment #3 from kkojima at gcc dot gnu dot org 2008-12-25 03:38 ------- Here is an another reduced testcase.
struct s { char a[512]; int b; int c; }; long long foo (struct s *p, int m, int r) { if (r == m) p->b = 3; p->c = 1; return m; } I've confirmed that this fails with the trunk compiler too. The insn scheduling before reload permutes the insns of the exit basic block like as: ;; ====================================================== ;; -- basic block 5 from 18 to 38 -- before reload ;; ====================================================== ;; 0--> 18 r166=0x204 :(issue+load_store),nothing,memory changing bb of uid 55 ;; 0--> 55 {r170=r161<<0x1;t=r161<0x0;} :issue,int changing bb of uid 56 ;; 1--> 56 r170=-t :issue,int changing bb of uid 46 ;; 1--> 46 r0=r161 :issue ;; 2--> 19 r168=0x1 :issue,int changing bb of uid 47 ;; 2--> 47 r1=r170 :issue ;; 3--> 20 [r160+r166]=r168 :(issue+load_store),nothing,memory ;; 3--> 38 use r0 :nothing i.e. insn 46 r0=r161 is placed before insn 20. Unfortunately insn 20 [r160+r166]=r168 requires r0 because sh has r0 + reg addressing only. -fno-schedule-insns gets rid of the error, though I have no idea for the right solution ATM. -- kkojima at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Known to fail|4.3.2 |4.3.2 4.4.0 Priority|P3 |P4 Last reconfirmed|0000-00-00 00:00:00 |2008-12-25 03:38:20 date| | Summary|[4.3 Regression] sh gcc |[4.3/4.4 Regression] sh gcc |unable to spill register |unable to spill register |when building ghostscript- |when building ghostscript- |gpl with -O2 |gpl with -O2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38621