This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR41654
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 10 Oct 2009 16:49:36 +0200 (CEST)
- Subject: [PATCH] Fix PR41654
This fixes PR41654 - we should, as in other places, use
canonicalize_cond_expr_cond before trying to make a GIMPLE_COND
from it.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2009-10-10 Richard Guenther <rguenther@suse.de>
PR tree-optimization/41654
* tree-ssa-ifcombine.c (ifcombine_ifandif): Properly canonicalize
a cond expr before calling gimple_cond_set_condition_from_tree.
(ifcombine_iforif): Likewise.
* gfortran.fortran-torture/compile/pr41654.f90: New testcase.
Index: gcc/tree-ssa-ifcombine.c
===================================================================
*** gcc/tree-ssa-ifcombine.c (revision 152615)
--- gcc/tree-ssa-ifcombine.c (working copy)
*************** ifcombine_ifandif (basic_block inner_con
*** 340,345 ****
--- 340,348 ----
t2 = force_gimple_operand_gsi (&gsi, t2, true, NULL_TREE,
true, GSI_SAME_STMT);
t = fold_build2 (EQ_EXPR, boolean_type_node, t2, t);
+ t = canonicalize_cond_expr_cond (t);
+ if (!t)
+ return false;
gimple_cond_set_condition_from_tree (inner_cond, t);
update_stmt (inner_cond);
*************** ifcombine_iforif (basic_block inner_cond
*** 488,493 ****
--- 491,499 ----
true, GSI_SAME_STMT);
t = fold_build2 (NE_EXPR, boolean_type_node, t,
build_int_cst (TREE_TYPE (t), 0));
+ t = canonicalize_cond_expr_cond (t);
+ if (!t)
+ return false;
gimple_cond_set_condition_from_tree (inner_cond, t);
update_stmt (inner_cond);
Index: gcc/testsuite/gfortran.fortran-torture/compile/pr41654.f90
===================================================================
*** gcc/testsuite/gfortran.fortran-torture/compile/pr41654.f90 (revision 0)
--- gcc/testsuite/gfortran.fortran-torture/compile/pr41654.f90 (revision 0)
***************
*** 0 ****
--- 1,15 ----
+ SUBROUTINE SCANBUFR (LBUFRIGNOREERROR, LBOPRPRO, LLSPLIT)
+ LOGICAL :: LBUFRIGNOREERROR, LBOPRPRO, LLSPLIT
+ INTEGER :: IBOTYP, IBSTYP
+ IF ((IBOTYP.eq.0).AND.(IBSTYP.eq.1)) GO TO 251
+ IF ((IBOTYP.eq.0).AND.(IBSTYP.eq.3)) GO TO 251
+ IF(LBUFRIGNOREERROR) THEN
+ goto 360
+ ENDIF
+ 251 CONTINUE
+ IF(LBOPRPRO.AND.LLSPLIT) THEN
+ CALL OBSCREEN
+ ENDIF
+ 360 CONTINUE
+ END SUBROUTINE SCANBUFR
+