The inlined patch fixes a problem where an array constructor is used as the shape argument in RESHAPE. The patch is straightforward and self-explanatory. Regression tested on x86_64-*-freebsd11 Ok?
2013-11-05 Steven G. Kargl <ka...@gcc.gnu.org> PR fortran/58989 * check.c (gfc_check_reshape): ensure that shape is a constant expression. 2013-11-05 Steven G. Kargl <ka...@gcc.gnu.org> PR fortran/58989 * gfortran.dg/reshape_6.f90: New test. Index: gcc/fortran/check.c =================================================================== --- gcc/fortran/check.c (revision 204372) +++ gcc/fortran/check.c (working copy) @@ -3277,7 +3277,7 @@ gfc_check_reshape (gfc_expr *source, gfc "than %d elements", &shape->where, GFC_MAX_DIMENSIONS); return false; } - else if (shape->expr_type == EXPR_ARRAY) + else if (shape->expr_type == EXPR_ARRAY && gfc_is_constant_expr (shape)) { gfc_expr *e; int i, extent; Index: gcc/testsuite/gfortran.dg/reshape_6.f90 =================================================================== --- gcc/testsuite/gfortran.dg/reshape_6.f90 (revision 0) +++ gcc/testsuite/gfortran.dg/reshape_6.f90 (working copy) @@ -0,0 +1,19 @@ +! { dg-do compile } +! PR fortran/58989 +! +program test + + real(8), dimension(4,4) :: fluxes + real(8), dimension(2,2,2,2) :: f + integer, dimension(3) :: dmmy + integer, parameter :: indx(4)=(/2,2,2,2/) + + fluxes = 1 + + dmmy = (/2,2,2/) + + f = reshape(fluxes,(/dmmy,2/)) ! Caused an ICE + f = reshape(fluxes,(/2,2,2,2/)) ! Works as expected + f = reshape(fluxes,indx) ! Works as expected + +end program test -- Steve