aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Morin <mikael@gcc.gnu.org>2010-09-07 16:04:55 +0000
committerMikael Morin <mikael@gcc.gnu.org>2010-09-07 16:04:55 +0000
commit86e033e21a4f61128173b4b1f4dedf07616068d7 (patch)
tree621c836e7b1da6680756ece6af0fc95a362cf496
parentee187353052b7ae1654eae9f86635cff306fc25e (diff)
downloadgcc-86e033e21a4f61128173b4b1f4dedf07616068d7.zip
gcc-86e033e21a4f61128173b4b1f4dedf07616068d7.tar.gz
gcc-86e033e21a4f61128173b4b1f4dedf07616068d7.tar.bz2
re PR fortran/45564 (gfortran.dg/achar_4.f90 ICE: verify_gimple failed: type mismatch in comparison expression with -fbounds-check)
2010-09-07 Mikael Morin <mikael@gcc.gnu.org> * trans-stmt.c (gfc_trans_character_select): Be conversion-safe while checking string length value. * trans-intrinsic.c (gfc_conv_intrinsic_char): Build integer using gfc_charlen_type_node type. PR fortran/45564 * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Convert string length to gfc_charlen_type_node. 2010-09-07 Mikael Morin <mikael@gcc.gnu.org> * gfortran.dg/achar_4.f90: Enable bounds checking. From-SVN: r163958
-rw-r--r--gcc/fortran/ChangeLog11
-rw-r--r--gcc/fortran/trans-intrinsic.c4
-rw-r--r--gcc/fortran/trans-stmt.c2
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gfortran.dg/achar_4.f901
5 files changed, 19 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 22810de..99cc251 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,14 @@
+2010-09-07 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-stmt.c (gfc_trans_character_select): Be conversion-safe while
+ checking string length value.
+ * trans-intrinsic.c (gfc_conv_intrinsic_char): Build integer using
+ gfc_charlen_type_node type.
+
+ PR fortran/45564
+ * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Convert string
+ length to gfc_charlen_type_node.
+
2010-09-06 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/36931
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index c49908b..c33b20f 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -1428,7 +1428,7 @@ gfc_conv_intrinsic_char (gfc_se * se, gfc_expr * expr)
arg[0] = fold_build1_loc (input_location, NOP_EXPR, type, arg[0]);
gfc_add_modify (&se->pre, var, arg[0]);
se->expr = gfc_build_addr_expr (build_pointer_type (type), var);
- se->string_length = integer_one_node;
+ se->string_length = build_int_cst (gfc_charlen_type_node, 1);
}
@@ -4709,7 +4709,7 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr)
se->expr = info->descriptor;
if (expr->ts.type == BT_CHARACTER)
- se->string_length = dest_word_len;
+ se->string_length = fold_convert (gfc_charlen_type_node, dest_word_len);
return;
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index dda38b6..caa9572 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -1692,7 +1692,7 @@ gfc_trans_character_select (gfc_code *code)
gfc_init_block (&body);
/* Attempt to optimize length 1 selects. */
- if (expr1se.string_length == integer_one_node)
+ if (integer_onep (expr1se.string_length))
{
for (d = cp; d; d = d->right)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2a4496d..289b6b8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2010-09-07 Mikael Morin <mikael@gcc.gnu.org>
+
+ * gfortran.dg/achar_4.f90: Enable bounds checking.
+
2010-09-07 Uros Bizjak <ubizjak@gmail.com>
PR target/45206
diff --git a/gcc/testsuite/gfortran.dg/achar_4.f90 b/gcc/testsuite/gfortran.dg/achar_4.f90
index 3bbc2af5..eb49db8 100644
--- a/gcc/testsuite/gfortran.dg/achar_4.f90
+++ b/gcc/testsuite/gfortran.dg/achar_4.f90
@@ -1,4 +1,5 @@
! { dg-do run }
+! { dg-options "-fbounds-check" }
! Tests the fix for PR31257, in which achar caused an ICE because it had no
! charlen.
!