diff options
Diffstat (limited to 'gcc/fortran/primary.c')
-rw-r--r-- | gcc/fortran/primary.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index b07632d..f6ceae9 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -2007,7 +2007,6 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts) if (expr->expr_type != EXPR_VARIABLE && expr->expr_type != EXPR_FUNCTION) gfc_internal_error ("gfc_variable_attr(): Expression isn't a variable"); - ref = expr->ref; sym = expr->symtree->n.sym; attr = sym->attr; @@ -2031,7 +2030,7 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts) if (ts != NULL && expr->ts.type == BT_UNKNOWN) *ts = sym->ts; - for (; ref; ref = ref->next) + for (ref = expr->ref; ref; ref = ref->next) switch (ref->type) { case REF_ARRAY: @@ -2986,13 +2985,7 @@ match_variable (gfc_expr **result, int equiv_flag, int host_flag) switch (sym->attr.flavor) { case FL_VARIABLE: - if (sym->attr.is_protected && sym->attr.use_assoc) - { - gfc_error ("Assigning to PROTECTED variable at %C"); - return MATCH_ERROR; - } - if (sym->assoc) - sym->assoc->variable = 1; + /* Everything is alright. */ break; case FL_UNKNOWN: @@ -3024,22 +3017,24 @@ match_variable (gfc_expr **result, int equiv_flag, int host_flag) case FL_PARAMETER: if (equiv_flag) - gfc_error ("Named constant at %C in an EQUIVALENCE"); - else - gfc_error ("Cannot assign to a named constant at %C"); - return MATCH_ERROR; + { + gfc_error ("Named constant at %C in an EQUIVALENCE"); + return MATCH_ERROR; + } + /* Otherwise this is checked for and an error given in the + variable definition context checks. */ break; case FL_PROCEDURE: /* Check for a nonrecursive function result variable. */ if (sym->attr.function - && !sym->attr.external - && sym->result == sym - && (gfc_is_function_return_value (sym, gfc_current_ns) - || (sym->attr.entry - && sym->ns == gfc_current_ns) - || (sym->attr.entry - && sym->ns == gfc_current_ns->parent))) + && !sym->attr.external + && sym->result == sym + && (gfc_is_function_return_value (sym, gfc_current_ns) + || (sym->attr.entry + && sym->ns == gfc_current_ns) + || (sym->attr.entry + && sym->ns == gfc_current_ns->parent))) { /* If a function result is a derived type, then the derived type may still have to be resolved. */ |