diff options
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 3b46b4e..474e9ec 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -1061,6 +1061,27 @@ gfc_is_constant_expr (gfc_expr *e) } +/* Is true if the expression or symbol is a passed CFI descriptor. */ +bool +is_CFI_desc (gfc_symbol *sym, gfc_expr *e) +{ + if (sym == NULL + && e && e->expr_type == EXPR_VARIABLE) + sym = e->symtree->n.sym; + + if (sym && sym->attr.dummy + && sym->ns->proc_name->attr.is_bind_c + && sym->attr.dimension + && (sym->attr.pointer + || sym->attr.allocatable + || sym->as->type == AS_ASSUMED_SHAPE + || sym->as->type == AS_ASSUMED_RANK)) + return true; + +return false; +} + + /* Is true if an array reference is followed by a component or substring reference. */ bool @@ -1068,11 +1089,14 @@ is_subref_array (gfc_expr * e) { gfc_ref * ref; bool seen_array; + gfc_symbol *sym; if (e->expr_type != EXPR_VARIABLE) return false; - if (e->symtree->n.sym->attr.subref_array_pointer) + sym = e->symtree->n.sym; + + if (sym->attr.subref_array_pointer) return true; seen_array = false; @@ -1097,10 +1121,10 @@ is_subref_array (gfc_expr * e) return seen_array; } - if (e->symtree->n.sym->ts.type == BT_CLASS - && e->symtree->n.sym->attr.dummy - && CLASS_DATA (e->symtree->n.sym)->attr.dimension - && CLASS_DATA (e->symtree->n.sym)->attr.class_pointer) + if (sym->ts.type == BT_CLASS + && sym->attr.dummy + && CLASS_DATA (sym)->attr.dimension + && CLASS_DATA (sym)->attr.class_pointer) return true; return false; |