aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/expr.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2012-04-16 23:47:35 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2012-04-16 23:47:35 +0200
commit4a1016814c2121920459d13ccb4c841b3a537951 (patch)
tree6f8f9a6dfa3ca63e08395668b8ea280c79920cb5 /gcc/fortran/expr.c
parentde86e0a5d32fcaa2ec236f745fe7713cdedbaad4 (diff)
downloadgcc-4a1016814c2121920459d13ccb4c841b3a537951.zip
gcc-4a1016814c2121920459d13ccb4c841b3a537951.tar.gz
gcc-4a1016814c2121920459d13ccb4c841b3a537951.tar.bz2
[multiple changes]
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. From-SVN: r186507
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r--gcc/fortran/expr.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index e6a9c88..d961441 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)
{