re PR fortran/58989 (internal compiler error when using reshape function)

2013-11-05  Steven G. Kargl <kargl@gcc.gnu.org>

	PR fortran/58989
	* check.c (gfc_check_reshape): ensure that shape is a constant
	expression.

2013-11-05  Steven G. Kargl <kargl@gcc.gnu.org>

	PR fortran/58989
	* gfortran.dg/reshape_6.f90: New test.

From-SVN: r204419
This commit is contained in:
Steven G. Kargl 2013-11-05 20:02:43 +00:00
parent ae40b2ffce
commit df1c87913c
4 changed files with 31 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2013-11-05 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/58989
* check.c (gfc_check_reshape): ensure that shape is a constant
expression.
2013-11-05 Tobias Burnus <burnus@net-b.de>
* lang.opt (fopenmp-simd): New option.

View file

@ -3277,7 +3277,7 @@ gfc_check_reshape (gfc_expr *source, gfc_expr *shape,
"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;

View file

@ -1,3 +1,8 @@
2013-11-05 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/58989
* gfortran.dg/reshape_6.f90: New test.
2013-10-05 Jeff Law <law@redhat.com>
* gcc.dg/pr38984.c: Add -fno-isolate-erroneous-paths.

View file

@ -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