aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2005-12-13 09:54:03 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2005-12-13 09:54:03 +0000
commit93fc8073fc425f684cc58ac301464c1e90f2770d (patch)
tree8994f075205f28e587e5bffbf03d1e9e3d9e5f25 /gcc
parent65260edb31003a77a2f8aa6c0399ee904a0a4ca7 (diff)
downloadgcc-93fc8073fc425f684cc58ac301464c1e90f2770d.zip
gcc-93fc8073fc425f684cc58ac301464c1e90f2770d.tar.gz
gcc-93fc8073fc425f684cc58ac301464c1e90f2770d.tar.bz2
trans-expr.c (gfc_conv_substring): Use fold_build2 and build_int_cst.
2005-12-13 Richard Guenther <rguenther@suse.de> * trans-expr.c (gfc_conv_substring): Use fold_build2 and build_int_cst. From-SVN: r108476
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog5
-rw-r--r--gcc/fortran/trans-expr.c11
2 files changed, 10 insertions, 6 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index ea1afe1..cc6824b 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,8 @@
+2005-12-13 Richard Guenther <rguenther@suse.de>
+
+ * trans-expr.c (gfc_conv_substring): Use fold_build2 and
+ build_int_cst.
+
2005-12-13 Richard Sandiford <richard@codesourcery.com>
* Make-lang.in (fortran/trans-resolve.o): Depend on
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 5e1535e..7def3ad 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -246,12 +246,11 @@ gfc_conv_substring (gfc_se * se, gfc_ref * ref, int kind)
gfc_conv_expr_type (&end, ref->u.ss.end, gfc_charlen_type_node);
gfc_add_block_to_block (&se->pre, &end.pre);
}
- tmp =
- build2 (MINUS_EXPR, gfc_charlen_type_node,
- fold_convert (gfc_charlen_type_node, integer_one_node),
- start.expr);
- tmp = build2 (PLUS_EXPR, gfc_charlen_type_node, end.expr, tmp);
- se->string_length = fold (tmp);
+ tmp = fold_build2 (MINUS_EXPR, gfc_charlen_type_node,
+ build_int_cst (gfc_charlen_type_node, 1),
+ start.expr);
+ tmp = fold_build2 (PLUS_EXPR, gfc_charlen_type_node, end.expr, tmp);
+ se->string_length = tmp;
}