aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorJose Rui Faustino de Sousa <jrfsousa@gmail.com>2020-04-22 18:20:26 +0200
committerThomas König <tkoenig@gcc.gnu.org>2020-04-22 18:20:26 +0200
commit808a6eadda1a353ce3a70556feac128580491b24 (patch)
tree0625b3c4972f2ee041039fc19c22144e91c20998 /gcc/fortran
parent183e9006cc0300257d6f74d573514ef86f78cb4e (diff)
downloadgcc-808a6eadda1a353ce3a70556feac128580491b24.zip
gcc-808a6eadda1a353ce3a70556feac128580491b24.tar.gz
gcc-808a6eadda1a353ce3a70556feac128580491b24.tar.bz2
For assumed-size arrays check if the reference is to a full array.
2020-04-22 José Rui Faustino de Sousa <jrfsousa@gmail.com> PR fortran/90350 * simplify.c (simplify_bound): In the case of assumed-size arrays check if the reference is to a full array. 2020-04-22 José Rui Faustino de Sousa <jrfsousa@gmail.com> PR fortran/90350 * gfortran.dg/PR90350.f90: New test.
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/simplify.c4
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index e02815e..1ab0514 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2020-04-22 José Rui Faustino de Sousa <jrfsousa@gmail.com>
+
+ PR fortran/90350
+ * simplify.c (simplify_bound): In the case of assumed-size arrays
+ check if the reference is to a full array.
+
2020-04-22 Tobias Burnus <tobias@codesourcery.com>
PR fortran/94709
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index c7a4f77..eb8b2af 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -4157,6 +4157,7 @@ simplify_bound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind, int upper)
{
gfc_ref *ref;
gfc_array_spec *as;
+ ar_type type = AR_UNKNOWN;
int d;
if (array->ts.type == BT_CLASS)
@@ -4180,6 +4181,7 @@ simplify_bound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind, int upper)
switch (ref->type)
{
case REF_ARRAY:
+ type = ref->u.ar.type;
switch (ref->u.ar.type)
{
case AR_ELEMENT:
@@ -4233,7 +4235,7 @@ simplify_bound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind, int upper)
int k;
/* UBOUND(ARRAY) is not valid for an assumed-size array. */
- if (upper && as && as->type == AS_ASSUMED_SIZE)
+ if (upper && type == AR_FULL && as && as->type == AS_ASSUMED_SIZE)
{
/* An error message will be emitted in
check_assumed_size_reference (resolve.c). */