diff options
author | Mikael Morin <mikael@gcc.gnu.org> | 2015-05-01 13:32:42 +0000 |
---|---|---|
committer | Mikael Morin <mikael@gcc.gnu.org> | 2015-05-01 13:32:42 +0000 |
commit | 11642de8a8c04a4e9c0eeea663e53e27eae7537a (patch) | |
tree | 290809dd2859bb40c21b878fcd3db098a2f2b075 /gcc/fortran/simplify.c | |
parent | 50093a330f9e4d1b816f77c4ff8bb0dcfea96549 (diff) | |
download | gcc-11642de8a8c04a4e9c0eeea663e53e27eae7537a.zip gcc-11642de8a8c04a4e9c0eeea663e53e27eae7537a.tar.gz gcc-11642de8a8c04a4e9c0eeea663e53e27eae7537a.tar.bz2 |
Allow bound simplification of array subreferences.
gcc/fortran/
* simplify.c (simplify_bound_dim): Tighten the check for array fullness
by also checking for absence of subreference.
(simplify_bound): Don't skip simplification if the array
has subreferences.
(simplify_cobound): Same.
gcc/testsuite/
* gfortran.dg/bound_simplification_4.f90: New.
From-SVN: r222681
Diffstat (limited to 'gcc/fortran/simplify.c')
-rw-r--r-- | gcc/fortran/simplify.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index f631ac8..4ef9025 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -3338,7 +3338,7 @@ simplify_bound_dim (gfc_expr *array, gfc_expr *kind, int d, int upper, result = gfc_get_constant_expr (BT_INTEGER, k, &array->where); /* Then, we need to know the extent of the given dimension. */ - if (coarray || ref->u.ar.type == AR_FULL) + if (coarray || (ref->u.ar.type == AR_FULL && !ref->next)) { l = as->lower[d-1]; u = as->upper[d-1]; @@ -3417,10 +3417,7 @@ simplify_bound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind, int upper) case AR_FULL: /* We're done because 'as' has already been set in the previous iteration. */ - if (!ref->next) - goto done; - - /* Fall through. */ + goto done; case AR_UNKNOWN: return NULL; @@ -3589,10 +3586,7 @@ simplify_cobound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind, int upper) case AR_FULL: /* We're done because 'as' has already been set in the previous iteration. */ - if (!ref->next) - goto done; - - /* Fall through. */ + goto done; case AR_UNKNOWN: return NULL; |