This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR41011, IPA-CP ICEing
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 12 Aug 2009 17:04:28 +0200 (CEST)
- Subject: [PATCH] Fix PR41011, IPA-CP ICEing
This fixes the PR by dealing with failing foldings such as
&a->b[0] p+ 2 where 2 is not a multiple of the array element size
or fails in build_ref_for_offset, likely due to similar reasons.
Bootstrap and regtest scheduled, I'll apply this if it succeeds.
Richard.
2009-08-12 Richard Guenther <rguenther@suse.de>
PR tree-optimization/41011
* ipa-cp.c (ipcp_lattice_from_jfunc): Deal with failing fold
and reference constructing.
* gfortran.dg/pr41011.f: New testcase.
Index: gcc/ipa-cp.c
===================================================================
*** gcc/ipa-cp.c (revision 150619)
--- gcc/ipa-cp.c (working copy)
*************** ipcp_lattice_from_jfunc (struct ipa_node
*** 302,308 ****
cst = fold_binary (jfunc->value.pass_through.operation,
TREE_TYPE (cst), cst,
jfunc->value.pass_through.operand);
! gcc_assert (cst && is_gimple_ip_invariant (cst));
lat->constant = cst;
}
else if (jfunc->type == IPA_JF_ANCESTOR)
--- 302,309 ----
cst = fold_binary (jfunc->value.pass_through.operation,
TREE_TYPE (cst), cst,
jfunc->value.pass_through.operand);
! if (!cst || !is_gimple_ip_invariant (cst))
! lat->type = IPA_BOTTOM;
lat->constant = cst;
}
else if (jfunc->type == IPA_JF_ANCESTOR)
*************** ipcp_lattice_from_jfunc (struct ipa_node
*** 325,332 ****
ok = build_ref_for_offset (&t, TREE_TYPE (t),
jfunc->value.ancestor.offset,
jfunc->value.ancestor.type, false);
! gcc_assert (ok);
! lat->constant = build_fold_addr_expr (t);
}
else
lat->type = IPA_BOTTOM;
--- 326,338 ----
ok = build_ref_for_offset (&t, TREE_TYPE (t),
jfunc->value.ancestor.offset,
jfunc->value.ancestor.type, false);
! if (!ok)
! {
! lat->type = IPA_BOTTOM;
! lat->constant = NULL_TREE;
! }
! else
! lat->constant = build_fold_addr_expr (t);
}
else
lat->type = IPA_BOTTOM;
Index: gcc/testsuite/gfortran.dg/pr41011.f
===================================================================
*** gcc/testsuite/gfortran.dg/pr41011.f (revision 0)
--- gcc/testsuite/gfortran.dg/pr41011.f (revision 0)
***************
*** 0 ****
--- 1,23 ----
+ ! { dg-do compile }
+ ! { dg-options "-O3 -fwhole-file" }
+ CALL UVSET(NX,NY,NZ,HVAR,ZET,NP,DZ,DKM,UM,VM,UG,VG,TM,DCDX,
+ *ITY,ISH,NSMT,F)
+ CALL DCTDX(NX,NY,NX1,NFILT,C(MLAG),DCDX(MLAG),HELP,HELPA,
+ * HELP,HELPA,FY,FYC,SAVEY)
+ END
+ SUBROUTINE PADEC(DKS,DKDS,HVAR,WM,WG,FN,NS,AN,BN,CN,IT)
+ COMPLEX*16 WM(*),WG(*),FN(*),AN(*),BN(*),CN(*)
+ BN(J)=F4+AS+GAMMA*F2
+ CN(J)=F4-AS+GAMMA*F2
+ FN(J)=(AS+F4-GAMMA*F2)*H2+(F4-AS-GAMMA*F2)*H0+
+ * H1*(F3-GAMMA/3.D0)+GAMMA*WG(J)-CONST
+ END
+ SUBROUTINE UVSET(NX,NY,NZ,HVAR,ZET,NP,DZ,DKM,UM,VM,UG,VG,TM,
+ *WORK,ITY,IH,NSMT,F)
+ DIMENSION HVAR(*),ZET(*),TM(*),DKM(*),UM(*),VM(*),UG(*),VG(*),
+ *WORK(*)
+ IF(IH.EQ.0) THEN
+ CALL PADEC(DKM,VM,HVAR,WORK(LWM),WORK(LWG),
+ * WORK(LF),NZ,WORK(LA),WORK(LB),WORK(LC),ITY)
+ ENDIF
+ END