+2018-03-19 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/84931
+ * simplify.c (gfc_convert_constant): Correctly handle iterators
+ for type conversion.
+
2018-03-18 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/77414
{
gfc_expr *tmp;
if (c->iterator == NULL)
- tmp = f (c->expr, kind);
+ {
+ tmp = f (c->expr, kind);
+ if (tmp == NULL)
+ {
+ gfc_free_expr (result);
+ return NULL;
+ }
+
+ gfc_constructor_append_expr (&result->value.constructor,
+ tmp, &c->where);
+ }
else
{
+ gfc_constructor *n;
g = gfc_convert_constant (c->expr, type, kind);
- if (g == &gfc_bad_expr)
+ if (g == NULL || g == &gfc_bad_expr)
{
gfc_free_expr (result);
return g;
}
- tmp = g;
- }
-
- if (tmp == NULL)
- {
- gfc_free_expr (result);
- return NULL;
+ n = gfc_constructor_get ();
+ n->expr = g;
+ n->iterator = gfc_copy_iterator (c->iterator);
+ n->where = c->where;
+ gfc_constructor_append (&result->value.constructor, n);
}
-
- gfc_constructor_append_expr (&result->value.constructor,
- tmp, &c->where);
}
break;
+2018-03-19 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/84931
+ * gfortran.dg/array_constructor_52.f90: New test.
+
2018-03-17 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/77414
--- /dev/null
+! { dg-do run }
+! PR 84931 - long array constructors with type conversion were not
+! handled correctly.
+program test
+ implicit none
+ integer, parameter :: n = 2**16
+ real, dimension(n) :: y
+ integer :: i
+ y = (/ (1, i=1, n) /)
+ if (y(2) /= 1) stop 1
+end program test