Commit 949d0060 by Thomas Koenig

re PR fortran/84931 (Expansion of array constructor with constant implied-do-object goes sideways)

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-19  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/84931
	* gfortran.dg/array_constructor_52.f90: New test.

From-SVN: r258641
parent 43bb589d
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
......
......@@ -8016,26 +8016,32 @@ gfc_convert_constant (gfc_expr *e, bt type, int kind)
{
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
......
! { 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment