re PR fortran/30882 ([4.1 and 4.2 only] size with initialization expression value for dim= is rejected)

2007-03-03  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/30882
	* check.c (dim_rank_check): The shape of subsections of
	assumed-size arrays is known.

2007-03-03  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/30882
	* gfortran.dg/size_dim.f90: New test.

--         Diese und die folgenden Zeilen werden ignoriert --

M    gcc/testsuite/ChangeLog
A    gcc/testsuite/gfortran.dg/size_dim.f90
M    gcc/fortran/ChangeLog
M    gcc/fortran/check.c

Co-Authored-By: Tobias Burnus <burnus@net-b.de>

From-SVN: r122503
This commit is contained in:
Paul Thomas 2007-03-03 10:43:25 +00:00 committed by Tobias Burnus
parent 39b8cd70c2
commit 93a12e361d
4 changed files with 31 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2007-03-03 Paul Thomas <pault@gcc.gnu.org>
PR fortran/30882
* check.c (dim_rank_check): The shape of subsections of
assumed-size arrays is known.
2007-03-02 Paul Thomas <pault@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>

View File

@ -337,7 +337,10 @@ dim_rank_check (gfc_expr *dim, gfc_expr *array, int allow_assumed)
ar = gfc_find_array_ref (array);
rank = array->rank;
if (ar->as->type == AS_ASSUMED_SIZE && !allow_assumed)
if (ar->as->type == AS_ASSUMED_SIZE
&& !allow_assumed
&& ar->type != AR_ELEMENT
&& ar->type != AR_SECTION)
rank--;
if (mpz_cmp_ui (dim->value.integer, 1) < 0

View File

@ -1,3 +1,9 @@
2007-03-03 Paul Thomas <pault@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
PR fortran/30882
* gfortran.dg/size_dim.f90: New test.
2007-03-02 Paul Thomas <pault@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>

View File

@ -0,0 +1,15 @@
! { dg-do "run" }
! Check size with initialization expression value for dim=
! PR fortran/30882
!
! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
!
program main
integer :: a(10)
call S1(a)
contains
subroutine S1(a)
integer :: a(*)
if(size(a(1:10),1) /= 10) call abort()
end subroutine S1
end program main