re PR fortran/38184 (invariant RESHAPE not expanded if SOURCE is empty)

2008-11-24  Mikael Morin  <mikael.morin@tele2.fr>

	PR fortran/38184
	* simplify.c (is_constant_array_expr): Return true instead of false
	if the array constructor is empty.

2008-11-24  Mikael Morin  <mikael.morin@tele2.fr>

	PR fortran/38184
	* gfortran.dg/reshape_empty_1.f03: New test.

From-SVN: r142168
This commit is contained in:
Mikael Morin 2008-11-24 20:04:34 +01:00 committed by Mikael Morin
parent c63d77544c
commit 6e7cc036d2
4 changed files with 31 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2008-11-24 Mikael Morin <mikael.morin@tele2.fr>
PR fortran/38184
* simplify.c (is_constant_array_expr): Return true instead of false
if the array constructor is empty.
2008-11-24 Daniel Kraft <d@domob.eu>
PR fortran/37779

View File

@ -3410,9 +3410,6 @@ is_constant_array_expr (gfc_expr *e)
if (e->expr_type != EXPR_ARRAY || !gfc_is_constant_expr (e))
return false;
if (e->value.constructor == NULL)
return false;
for (c = e->value.constructor; c; c = c->next)
if (c->expr->expr_type != EXPR_CONSTANT)
return false;

View File

@ -1,3 +1,8 @@
2008-11-24 Mikael Morin <mikael.morin@tele2.fr>
PR fortran/38184
* gfortran.dg/reshape_empty_1.f03: New test.
2008-11-24 Jack Howarth <howarth@bromo.med.uc.edu>
PR testsuite/38241

View File

@ -0,0 +1,20 @@
! { dg-do run }
! { dg-options "-fdump-tree-original" }
!
! PR fortran/38184
! invariant RESHAPE not expanded if SOURCE is empty.
!
! Original program by James Van Buskirk
integer, parameter :: N = 3
integer, parameter :: A(N,N) = reshape([integer::],[N,N],reshape([1],[N+1],[2]))
integer, parameter :: K = N*A(2,2)+A(2,3)
integer :: B(N,N) = reshape([1,2,2,2,1,2,2,2,1],[3,3])
integer :: i
i = 5
if (any(A /= B)) call abort
if (K /= i) call abort
end
! { dg-final { scan-tree-dump-times "\\\{1, 2, 2, 2, 1, 2, 2, 2, 1\\\}" 2 "original" } }
! { dg-final { cleanup-tree-dump "original" } }