Commit 4a101681 by Tobias Burnus Committed by Tobias Burnus

[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
parent de86e0a5
2012-04-16 Tobias Burnus <burnus@net-b.de>
PR fortran/52864
* expr.c (gfc_check_vardef_context): Fix assignment check for
pointer components.
2012-04-16 Janus Weil <janus@gcc.gnu.org> 2012-04-16 Janus Weil <janus@gcc.gnu.org>
PR fortran/52968 PR fortran/52968
......
...@@ -4645,9 +4645,11 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, ...@@ -4645,9 +4645,11 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj,
return FAILURE; return FAILURE;
} }
/* INTENT(IN) dummy argument. Check this, unless the object itself is /* INTENT(IN) dummy argument. Check this, unless the object itself is the
the component of sub-component of a pointer. Obviously, component of sub-component of a pointer; we need to distinguish
procedure pointers are of no interest here. */ 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 = true;
ptr_component = (sym->ts.type == BT_CLASS && CLASS_DATA (sym)) ptr_component = (sym->ts.type == BT_CLASS && CLASS_DATA (sym))
? CLASS_DATA (sym)->attr.class_pointer : sym->attr.pointer; ? 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, ...@@ -4656,7 +4658,11 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj,
if (ptr_component && ref->type == REF_COMPONENT) if (ptr_component && ref->type == REF_COMPONENT)
check_intentin = false; check_intentin = false;
if (ref->type == REF_COMPONENT && ref->u.c.component->attr.pointer) 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) if (check_intentin && sym->attr.intent == INTENT_IN)
{ {
......
2012-04-16 Tobias Burnus <burnus@net-b.de> 2012-04-16 Tobias Burnus <burnus@net-b.de>
PR fortran/52864
* gfortran.dg/pointer_intent_6.f90: New.
2012-04-16 Tobias Burnus <burnus@net-b.de>
PR fortran/52916 PR fortran/52916
* gfortran.dg/public_private_module_3.f90: Use dg-additional-sources * gfortran.dg/public_private_module_3.f90: Use dg-additional-sources
to include public_private_module_4.f90. to include public_private_module_4.f90.
......
! { dg-do compile }
!
! PR fortran/52864
!
! Assigning to an intent(in) pointer (which is valid).
!
program test
type PoisFFT_Solver3D
complex, dimension(:,:,:), &
pointer :: work => null()
end type PoisFFT_Solver3D
contains
subroutine PoisFFT_Solver3D_FullPeriodic(D, p)
type(PoisFFT_Solver3D), intent(in) :: D
real, intent(in), pointer :: p(:)
D%work(i,j,k) = 0.0
p = 0.0
end subroutine
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment