re PR fortran/30882 ([4.1 and 4.2 only] size with initialization expression value...
authorPaul Thomas <pault@gcc.gnu.org>
Sat, 3 Mar 2007 10:43:25 +0000 (10:43 +0000)
committerTobias Burnus <burnus@gcc.gnu.org>
Sat, 3 Mar 2007 10:43:25 +0000 (11:43 +0100)
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

gcc/fortran/ChangeLog
gcc/fortran/check.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/size_dim.f90 [new file with mode: 0644]

index afd9d26b6554912e52ff05d217c16999b1f380c6..58b96b6b75b2ac73b8104b6af676e80ba448d381 100644 (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>
 
index 6e4d798f6d1ab820d1ea8082c6559ea12bcc989e..27becfcb805ecdb58b188b4d27c1c598adce72db 100644 (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
index e87707c90d21f22665ab36bf167a0b33715affcc..e2d41a9b134420136ed236095715a21f713c70b0 100644 (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>
 
diff --git a/gcc/testsuite/gfortran.dg/size_dim.f90 b/gcc/testsuite/gfortran.dg/size_dim.f90
new file mode 100644 (file)
index 0000000..248a0c3
--- /dev/null
@@ -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