diff options
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r-- | gcc/fortran/module.c | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 838e55a..d71221c 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -1998,7 +1998,8 @@ enum ab_attribute AB_ARRAY_OUTER_DEPENDENCY, AB_MODULE_PROCEDURE, AB_OACC_DECLARE_CREATE, AB_OACC_DECLARE_COPYIN, AB_OACC_DECLARE_DEVICEPTR, AB_OACC_DECLARE_DEVICE_RESIDENT, AB_OACC_DECLARE_LINK, - AB_OMP_DECLARE_TARGET_LINK + AB_OMP_DECLARE_TARGET_LINK, AB_PDT_KIND, AB_PDT_LEN, AB_PDT_TYPE, + AB_PDT_TEMPLATE, AB_PDT_ARRAY, AB_PDT_STRING }; static const mstring attr_bits[] = @@ -2062,6 +2063,12 @@ static const mstring attr_bits[] = minit ("OACC_DECLARE_DEVICE_RESIDENT", AB_OACC_DECLARE_DEVICE_RESIDENT), minit ("OACC_DECLARE_LINK", AB_OACC_DECLARE_LINK), minit ("OMP_DECLARE_TARGET_LINK", AB_OMP_DECLARE_TARGET_LINK), + minit ("PDT_KIND", AB_PDT_KIND), + minit ("PDT_LEN", AB_PDT_LEN), + minit ("PDT_TYPE", AB_PDT_TYPE), + minit ("PDT_TEMPLATE", AB_PDT_TEMPLATE), + minit ("PDT_ARRAY", AB_PDT_ARRAY), + minit ("PDT_STRING", AB_PDT_STRING), minit (NULL, -1) }; @@ -2260,6 +2267,18 @@ mio_symbol_attribute (symbol_attribute *attr) MIO_NAME (ab_attribute) (AB_OACC_DECLARE_LINK, attr_bits); if (attr->omp_declare_target_link) MIO_NAME (ab_attribute) (AB_OMP_DECLARE_TARGET_LINK, attr_bits); + if (attr->pdt_kind) + MIO_NAME (ab_attribute) (AB_PDT_KIND, attr_bits); + if (attr->pdt_len) + MIO_NAME (ab_attribute) (AB_PDT_LEN, attr_bits); + if (attr->pdt_type) + MIO_NAME (ab_attribute) (AB_PDT_TYPE, attr_bits); + if (attr->pdt_template) + MIO_NAME (ab_attribute) (AB_PDT_TEMPLATE, attr_bits); + if (attr->pdt_array) + MIO_NAME (ab_attribute) (AB_PDT_ARRAY, attr_bits); + if (attr->pdt_string) + MIO_NAME (ab_attribute) (AB_PDT_STRING, attr_bits); mio_rparen (); @@ -2453,6 +2472,24 @@ mio_symbol_attribute (symbol_attribute *attr) case AB_OACC_DECLARE_LINK: attr->oacc_declare_link = 1; break; + case AB_PDT_KIND: + attr->pdt_kind = 1; + break; + case AB_PDT_LEN: + attr->pdt_len = 1; + break; + case AB_PDT_TYPE: + attr->pdt_type = 1; + break; + case AB_PDT_TEMPLATE: + attr->pdt_template = 1; + break; + case AB_PDT_ARRAY: + attr->pdt_array = 1; + break; + case AB_PDT_STRING: + attr->pdt_string = 1; + break; } } } @@ -2779,6 +2816,9 @@ mio_component (gfc_component *c, int vtype) mio_typespec (&c->ts); mio_array_spec (&c->as); + /* PDT templates store the expression for the kind of a component here. */ + mio_expr (&c->kind_expr); + mio_symbol_attribute (&c->attr); if (c->ts.type == BT_CLASS) c->attr.class_ok = 1; @@ -3998,7 +4038,24 @@ mio_full_f2k_derived (gfc_symbol *sym) { if (peek_atom () != ATOM_RPAREN) { + gfc_namespace *ns; + sym->f2k_derived = gfc_get_namespace (NULL, 0); + + /* PDT templates make use of the mechanisms for formal args + and so the parameter symbols are stored in the formal + namespace. Transfer the sym_root to f2k_derived and then + free the formal namespace since it is uneeded. */ + if (sym->attr.pdt_template && sym->formal && sym->formal->sym) + { + ns = sym->formal->sym->ns; + sym->f2k_derived->sym_root = ns->sym_root; + ns->sym_root = NULL; + ns->refs++; + gfc_free_namespace (ns); + ns = NULL; + } + mio_f2k_derived (sym->f2k_derived); } else |