aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2010-07-06 19:48:58 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2010-07-06 19:48:58 +0000
commit7114ab45797aeeca8ef7ca25b215319d551a2b1c (patch)
tree43b2eca03385acce1e46e5f7bb4b98b29b0018fe /gcc/fortran
parent0060a10ae887561aef22299f92098d04aee1cf14 (diff)
downloadgcc-7114ab45797aeeca8ef7ca25b215319d551a2b1c.zip
gcc-7114ab45797aeeca8ef7ca25b215319d551a2b1c.tar.gz
gcc-7114ab45797aeeca8ef7ca25b215319d551a2b1c.tar.bz2
PR fortran/PR44693
2010-07-06 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/PR44693 * check.c (dim_rank_check): Also check intrinsic functions. Adjust permissible rank for functions which reduce the rank of their argument. Spread is an exception, where DIM can be one larger than the rank of array. 2010-07-06 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/PR44693 * gfortran.dg/dim_range_1.f90: New test. * gfortran.dg/minmaxloc_4.f90: Remove invalid test. From-SVN: r161884
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/check.c11
2 files changed, 15 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 7714abf..0d43b6c 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,11 @@
+2010-07-06 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/PR44693
+ * check.c (dim_rank_check): Also check intrinsic functions.
+ Adjust permissible rank for functions which reduce the rank of
+ their argument. Spread is an exception, where DIM can
+ be one larger than the rank of array.
+
2010-07-05 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/44797
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 3452717..27bd900 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -473,12 +473,15 @@ dim_rank_check (gfc_expr *dim, gfc_expr *array, int allow_assumed)
if (dim == NULL)
return SUCCESS;
- if (dim->expr_type != EXPR_CONSTANT
- || (array->expr_type != EXPR_VARIABLE
- && array->expr_type != EXPR_ARRAY))
+ if (dim->expr_type != EXPR_CONSTANT)
return SUCCESS;
- rank = array->rank;
+ if (array->expr_type == EXPR_FUNCTION && array->value.function.isym
+ && array->value.function.isym->id == GFC_ISYM_SPREAD)
+ rank = array->rank + 1;
+ else
+ rank = array->rank;
+
if (array->expr_type == EXPR_VARIABLE)
{
ar = gfc_find_array_ref (array);