diff options
author | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-16 21:47:35 +0000 |
---|---|---|
committer | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-16 21:47:35 +0000 |
commit | 308fdd1f75d8f7da33469a670021f91a0ca4893b (patch) | |
tree | 6f8f9a6dfa3ca63e08395668b8ea280c79920cb5 /gcc/fortran/expr.c | |
parent | 312d089d03a4b42a292eebf9aeb9f653c0a2af2a (diff) |
2012-04-12 Tobias Burnus <burnus@net-b.de>
PR fortran/52864
* expr.c (gfc_check_vardef_context): Fix assignment check for
pointer components.
2012-04-16 Tobias Burnus <burnus@net-b.de>
PR fortran/52864
* gfortran.dg/pointer_intent_6.f90: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186507 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index e6a9c885f023..d9614413e67e 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -4645,9 +4645,11 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, return FAILURE; } - /* INTENT(IN) dummy argument. Check this, unless the object itself is - the component of sub-component of a pointer. Obviously, - procedure pointers are of no interest here. */ + /* INTENT(IN) dummy argument. Check this, unless the object itself is the + component of sub-component of a pointer; we need to distinguish + 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; ptr_component = (sym->ts.type == BT_CLASS && CLASS_DATA (sym)) ? CLASS_DATA (sym)->attr.class_pointer : sym->attr.pointer; @@ -4656,7 +4658,11 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, if (ptr_component && ref->type == REF_COMPONENT) check_intentin = false; if (ref->type == REF_COMPONENT && ref->u.c.component->attr.pointer) - ptr_component = true; + { + ptr_component = true; + if (!pointer) + check_intentin = false; + } } if (check_intentin && sym->attr.intent == INTENT_IN) { |