aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2019-01-31 22:21:28 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2019-01-31 22:21:28 +0000
commit1bd83e0b0ba5f2a32f7c453b6fd1c856036dfba2 (patch)
treec34f5feb9f2c9b16b3e778e1e504526cd81ac64d /gcc/fortran/resolve.c
parentba2c1ca8c3d28d791a2fb44c2e4bb4a7b4a5a2ce (diff)
downloadgcc-1bd83e0b0ba5f2a32f7c453b6fd1c856036dfba2.zip
gcc-1bd83e0b0ba5f2a32f7c453b6fd1c856036dfba2.tar.gz
gcc-1bd83e0b0ba5f2a32f7c453b6fd1c856036dfba2.tar.bz2
re PR fortran/88669 (Contiguous attribute wrongly rejected)
2019-01-31 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/88669 * resolve.c (resolve_component): If the reference is a BT_CLASS, copy the contiguous attribute from the reference and use the correct attributes. 2019-01-31 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/88669 * gfortran.dg/contiguous_9.f90: New test. From-SVN: r268432
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 2c49aea..5e95777 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -13761,6 +13761,7 @@ static bool
resolve_component (gfc_component *c, gfc_symbol *sym)
{
gfc_symbol *super_type;
+ symbol_attribute *attr;
if (c->attr.artificial)
return true;
@@ -13803,7 +13804,23 @@ resolve_component (gfc_component *c, gfc_symbol *sym)
}
/* F2008, C448. */
- if (c->attr.contiguous && (!c->attr.dimension || !c->attr.pointer))
+ if (c->ts.type == BT_CLASS)
+ {
+ if (CLASS_DATA (c))
+ {
+ attr = &(CLASS_DATA (c)->attr);
+
+ /* Fix up contiguous attribute. */
+ if (c->attr.contiguous)
+ attr->contiguous = 1;
+ }
+ else
+ attr = NULL;
+ }
+ else
+ attr = &c->attr;
+
+ if (attr && attr->contiguous && (!attr->dimension || !attr->pointer))
{
gfc_error ("Component %qs at %L has the CONTIGUOUS attribute but "
"is not an array pointer", c->name, &c->loc);