aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/array.c
diff options
context:
space:
mode:
authorDaniel Kraft <d@domob.eu>2010-08-13 09:26:05 +0200
committerDaniel Kraft <domob@gcc.gnu.org>2010-08-13 09:26:05 +0200
commitf5ca06e67847e071c6df8ca316afc042af8cb07d (patch)
treecfb530d8bd21c019453cd0cba78bea87e46daea2 /gcc/fortran/array.c
parentcf677bb86756a4ab60f1db9592261cfa90265b17 (diff)
downloadgcc-f5ca06e67847e071c6df8ca316afc042af8cb07d.zip
gcc-f5ca06e67847e071c6df8ca316afc042af8cb07d.tar.gz
gcc-f5ca06e67847e071c6df8ca316afc042af8cb07d.tar.bz2
gfortran.h (array_type): New type `AS_IMPLIED_SHAPE'.
2010-08-13 Daniel Kraft <d@domob.eu> * gfortran.h (array_type): New type `AS_IMPLIED_SHAPE'. * array.c (gfc_match_array_spec): Match implied-shape specification and handle AS_IMPLIED_SHAPE correctly otherwise. * decl.c (add_init_expr_to_sym): Set upper bounds for implied-shape. (variable_decl): Some checks for implied-shape declaration. * resolve.c (resolve_symbol): Assert that array-spec is no longer AS_IMPLIED_SHAPE in any case. 2010-08-13 Daniel Kraft <d@domob.eu> * gfortran.dg/implied_shape_1.f08: New test. * gfortran.dg/implied_shape_2.f90: New test. * gfortran.dg/implied_shape_3.f08: New test. From-SVN: r163221
Diffstat (limited to 'gcc/fortran/array.c')
-rw-r--r--gcc/fortran/array.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index cd261bf..a26be78 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -463,6 +463,12 @@ gfc_match_array_spec (gfc_array_spec **asp, bool match_dim, bool match_codim)
as->rank++;
current_type = match_array_element_spec (as);
+ /* Note that current_type == AS_ASSUMED_SIZE for both assumed-size
+ and implied-shape specifications. If the rank is at least 2, we can
+ distinguish between them. But for rank 1, we currently return
+ ASSUMED_SIZE; this gets adjusted later when we know for sure
+ whether the symbol parsed is a PARAMETER or not. */
+
if (as->rank == 1)
{
if (current_type == AS_UNKNOWN)
@@ -475,6 +481,15 @@ gfc_match_array_spec (gfc_array_spec **asp, bool match_dim, bool match_codim)
case AS_UNKNOWN:
goto cleanup;
+ case AS_IMPLIED_SHAPE:
+ if (current_type != AS_ASSUMED_SHAPE)
+ {
+ gfc_error ("Bad array specification for implied-shape"
+ " array at %C");
+ goto cleanup;
+ }
+ break;
+
case AS_EXPLICIT:
if (current_type == AS_ASSUMED_SIZE)
{
@@ -513,6 +528,12 @@ gfc_match_array_spec (gfc_array_spec **asp, bool match_dim, bool match_codim)
goto cleanup;
case AS_ASSUMED_SIZE:
+ if (as->rank == 2 && current_type == AS_ASSUMED_SIZE)
+ {
+ as->type = AS_IMPLIED_SHAPE;
+ break;
+ }
+
gfc_error ("Bad specification for assumed size array at %C");
goto cleanup;
}
@@ -570,6 +591,7 @@ coarray:
else
switch (as->cotype)
{ /* See how current spec meshes with the existing. */
+ case AS_IMPLIED_SHAPE:
case AS_UNKNOWN:
goto cleanup;