summaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>2016-09-08 22:33:10 +0000
committerkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>2016-09-08 22:33:10 +0000
commit3e7e4e148f62893f0aeed440887a4063efc203b7 (patch)
tree6c5ce11b8f25d62eea31762763a992aed00e4ed6 /gcc/fortran
parenta34338c90fa38c45b84f591e2110c7792ad953bb (diff)
downloadgcc-3e7e4e148f62893f0aeed440887a4063efc203b7.tar.gz
2016-09-08 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/69514 * array.c (gfc_match_array_constructor): If type-spec is present, walk the array constructor performing possible conversions for numeric types. 2016-09-08 Steven G. Kargl <kargl@gcc.gnu.org> Louis Krupp <lkrupp@gcc.gnu.org> PR fortran/69514 * gfortran.dg/pr69514_1.f90: New test. * gfortran.dg/pr69514_2.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240039 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/array.c11
2 files changed, 16 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index a0be0741ff1..53c6e2d50a9 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2016-09-08 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/69514
+ * array.c (gfc_match_array_constructor): If type-spec is present,
+ walk the array constructor performing possible conversions for
+ numeric types.
+
2016-09-08 Jakub Jelinek <jakub@redhat.com>
PR fortran/77500
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index 03c8b17178c..48a7250d108 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -1089,6 +1089,7 @@ match_array_cons_element (gfc_constructor_base *result)
match
gfc_match_array_constructor (gfc_expr **result)
{
+ gfc_constructor *c;
gfc_constructor_base head, new_cons;
gfc_undo_change_set changed_syms;
gfc_expr *expr;
@@ -1194,8 +1195,6 @@ done:
be converted. See PR fortran/67803. */
if (ts.type == BT_CHARACTER)
{
- gfc_constructor *c;
-
c = gfc_constructor_first (head);
for (; c; c = gfc_constructor_next (c))
{
@@ -1218,6 +1217,14 @@ done:
}
}
}
+
+ /* Walk the constructor and ensure type conversion for numeric types. */
+ if (gfc_numeric_ts (&ts))
+ {
+ c = gfc_constructor_first (head);
+ for (; c; c = gfc_constructor_next (c))
+ gfc_convert_type (c->expr, &ts, 1);
+ }
}
else
expr = gfc_get_array_expr (BT_UNKNOWN, 0, &where);