This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran] Call fold
- From: Paul Brook <paul at nowt dot org>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>,"gcc-g95 List" <gcc-g95-devel at lists dot sourceforge dot net>
- Date: Sat, 13 Sep 2003 00:33:46 +0100
- Subject: [gfortran] Call fold
Patch below adds some missing calls to fold. Most folding is done by the
frontend, but it can't see inside intrinsic functions.
Applied to tree-ssa branch.
Paul
2003-09-12 Paul Brook <paul@nowt.org>
* trans-intrinsic.c (gfc_conv_intrinsic_sign): Call fold.
diff -urpxCVS clean/tree-ssa/gcc/fortran/trans-intrinsic.c gcc/gcc/fortran/
trans-intrinsic.c
--- clean/tree-ssa/gcc/fortran/trans-intrinsic.c
+++ gcc/gcc/fortran/trans-intrinsic.c
@@ -841,11 +841,11 @@ gfc_conv_intrinsic_sign (gfc_se * se, gf
type = TREE_TYPE (arg);
zero = gfc_build_const (type, integer_zero_node);
- testa = build (GE_EXPR, boolean_type_node, arg, zero);
- testb = build (GE_EXPR, boolean_type_node, arg2, zero);
- tmp = build (TRUTH_XOR_EXPR, boolean_type_node, testa, testb);
- se->expr = build (COND_EXPR, type, tmp,
- build1 (NEGATE_EXPR, type, arg), arg);
+ testa = fold (build (GE_EXPR, boolean_type_node, arg, zero));
+ testb = fold (build (GE_EXPR, boolean_type_node, arg2, zero));
+ tmp = fold (build (TRUTH_XOR_EXPR, boolean_type_node, testa, testb));
+ se->expr = fold (build (COND_EXPR, type, tmp,
+ build1 (NEGATE_EXPR, type, arg), arg));
}