diff options
author | Tobias Burnus <burnus@net-b.de> | 2012-10-28 17:57:12 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2012-10-28 17:57:12 +0100 |
commit | 57bf28eab7d3b708b52d4d3f52b0f42966945b8d (patch) | |
tree | c44e73e72c315e9062bb21c9d63b806af2cd111c /gcc/fortran/expr.c | |
parent | 036e1775739f9449a055adae2cb262e17336f74d (diff) | |
download | gcc-57bf28eab7d3b708b52d4d3f52b0f42966945b8d.zip gcc-57bf28eab7d3b708b52d4d3f52b0f42966945b8d.tar.gz gcc-57bf28eab7d3b708b52d4d3f52b0f42966945b8d.tar.bz2 |
re PR fortran/54958 (Wrongly rejects ac-implied-DO variables which also occur with INTENT(IN))
2012-10-28 Tobias Burnus <burnus@net-b.de>
PR fortran/54958
* gfortran.h (gfc_resolve_iterator_expr,
gfc_check_vardef_context): Update prototype.
* expr.c (gfc_check_vardef_context): Add own_scope
argument and honour it.
* resolve.c (gfc_resolve_iterator_expr): Add own_scope
argument and honour it.
(resolve_deallocate_expr, resolve_allocate_expr,
resolve_data_variables, resolve_transfer
resolve_lock_unlock, resolve_code): Update calls.
* array.c (resolve_array_list): Ditto.
* check.c (gfc_check_atomic_def, gfc_check_atomic_ref): Ditto.
* interface.c (compare_actual_formal): Ditto.
* intrinsic.c (check_arglist): Ditto.
* io.c (resolve_tag, gfc_resolve_dt, gfc_resolve_inquire):
* Ditto.
2012-10-28 Tobias Burnus <burnus@net-b.de>
PR fortran/54958
* gfortran.dg/do_check_6.f90: New.
From-SVN: r192896
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 9ac0fc68..211f304 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -4634,13 +4634,15 @@ gfc_build_intrinsic_call (const char* name, locus where, unsigned numarg, ...) (F2008, 16.6.7) or pointer association context (F2008, 16.6.8). This is called from the various places when resolving the pieces that make up such a context. + If own_scope is true (applies to, e.g., ac-implied-do/data-implied-do + variables), some checks are not performed. Optionally, a possible error message can be suppressed if context is NULL and just the return status (SUCCESS / FAILURE) be requested. */ gfc_try gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, - const char* context) + bool own_scope, const char* context) { gfc_symbol* sym = NULL; bool is_pointer; @@ -4725,7 +4727,7 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, assignment to a pointer component from pointer-assignment to a pointer component. Note that (normal) assignment to procedure pointers is not possible. */ - check_intentin = true; + check_intentin = !own_scope; ptr_component = (sym->ts.type == BT_CLASS && CLASS_DATA (sym)) ? CLASS_DATA (sym)->attr.class_pointer : sym->attr.pointer; for (ref = e->ref; ref && check_intentin; ref = ref->next) @@ -4760,7 +4762,7 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, } /* PROTECTED and use-associated. */ - if (sym->attr.is_protected && sym->attr.use_assoc && check_intentin) + if (sym->attr.is_protected && sym->attr.use_assoc && check_intentin) { if (pointer && is_pointer) { @@ -4782,7 +4784,7 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, /* Variable not assignable from a PURE procedure but appears in variable definition context. */ - if (!pointer && gfc_pure (NULL) && gfc_impure_variable (sym)) + if (!pointer && !own_scope && gfc_pure (NULL) && gfc_impure_variable (sym)) { if (context) gfc_error ("Variable '%s' can not appear in a variable definition" @@ -4856,7 +4858,7 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, } /* Target must be allowed to appear in a variable definition context. */ - if (gfc_check_vardef_context (assoc->target, pointer, false, NULL) + if (gfc_check_vardef_context (assoc->target, pointer, false, false, NULL) == FAILURE) { if (context) |