diff options
author | Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de> | 2004-07-09 23:20:50 +0200 |
---|---|---|
committer | Tobias Schlüter <tobi@gcc.gnu.org> | 2004-07-09 23:20:50 +0200 |
commit | 4077d207437b94a2d07d76c93b6583d5920bf7a8 (patch) | |
tree | d3352c7a5ccff7412b5e6acf7f1978a0e40eb5b6 /gcc/fortran/array.c | |
parent | 1f33f6b4c779919d3dd77be7001747a621de0e6a (diff) | |
download | gcc-4077d207437b94a2d07d76c93b6583d5920bf7a8.zip gcc-4077d207437b94a2d07d76c93b6583d5920bf7a8.tar.gz gcc-4077d207437b94a2d07d76c93b6583d5920bf7a8.tar.bz2 |
re PR fortran/13201 (PARAMETER variables of nonconstant shape are accepted)
PR fortran/13201
* resolve.c (resolve_symbol): Verify that the shape of a
parameter array is not only explicit, but also constant.
* array.c (gfc_is_compile_time_shape): New function.
* gfortran.h (gfc_is_compile_time_shape): Add prototype.
From-SVN: r84400
Diffstat (limited to 'gcc/fortran/array.c')
-rw-r--r-- | gcc/fortran/array.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c index a7081d8..c7fc8bb 100644 --- a/gcc/fortran/array.c +++ b/gcc/fortran/array.c @@ -1973,3 +1973,22 @@ gfc_find_array_ref (gfc_expr * e) return &ref->u.ar; } + + +/* Find out if an array shape is known at compile time. */ + +int +gfc_is_compile_time_shape (gfc_array_spec *as) +{ + int i; + + if (as->type != AS_EXPLICIT) + return 0; + + for (i = 0; i < as->rank; i++) + if (!gfc_is_constant_expr (as->lower[i]) + || !gfc_is_constant_expr (as->upper[i])) + return 0; + + return 1; +} |