Commit 758e12af by Tobias Burnus Committed by Tobias Burnus

re PR fortran/40851 ([4.3/4.4/4.5] problem with deallocation of pointers)

2009-07-26  Tobias Burnus  <burnus@net-b.de>

        PR fortran/40851
        * resolve.c (resolve_symbol): Do not initialize pointer
        * derived-types.
        * trans-decl.c (init_intent_out_dt): Ditto.
        (generate_local_decl): No need to set attr.referenced for DT pointers.

2009-07-26  Tobias Burnus  <burnus@net-b.de>

        PR fortran/40851
        * gfortran.dg/derived_init_3.f90: New test.

From-SVN: r150108
parent d08d4988
2009-07-27 Tobias Burnus <burnus@net-b.de>
PR fortran/40851
* resolve.c (resolve_symbol): Do not initialize pointer derived-types.
* trans-decl.c (init_intent_out_dt): Ditto.
(generate_local_decl): No need to set attr.referenced for DT pointers.
2009-07-26 Tobias Burnus <burnus@net-b.de>
PR fortran/33197
......
......@@ -10036,7 +10036,7 @@ resolve_symbol (gfc_symbol *sym)
if ((!a->save && !a->dummy && !a->pointer
&& !a->in_common && !a->use_assoc
&& !(a->function && sym != sym->result))
|| (a->dummy && a->intent == INTENT_OUT))
|| (a->dummy && a->intent == INTENT_OUT && !a->pointer))
apply_default_init (sym);
}
......
......@@ -2958,7 +2958,8 @@ init_intent_out_dt (gfc_symbol * proc_sym, tree body)
gfc_init_block (&fnblock);
for (f = proc_sym->formal; f; f = f->next)
if (f->sym && f->sym->attr.intent == INTENT_OUT
&& f->sym->ts.type == BT_DERIVED)
&& !f->sym->attr.pointer
&& f->sym->ts.type == BT_DERIVED)
{
if (f->sym->ts.derived->attr.alloc_comp)
{
......@@ -3708,6 +3709,7 @@ generate_local_decl (gfc_symbol * sym)
if (!sym->attr.referenced
&& sym->ts.type == BT_DERIVED
&& sym->ts.derived->attr.alloc_comp
&& !sym->attr.pointer
&& ((sym->attr.dummy && sym->attr.intent == INTENT_OUT)
||
(sym->attr.result && sym != sym->result)))
......
2009-07-27 Tobias Burnus <burnus@net-b.de>
PR fortran/40851
* gfortran.dg/derived_init_3.f90: New test.
2009-07-26 Tobias Burnus <burnus@net-b.de>
PR fortran/33197
......
! { dg-do run }
!
! PR fortran/40851
!
! Make sure the an INTENT(OUT) dummy is not initialized
! when it is a pointer.
!
! Contributed by Juergen Reuter <juergen.reuter@desy.de>.
!
program main
type :: string
character,dimension(:),allocatable :: chars
end type string
type :: string_container
type(string) :: string
end type string_container
type(string_container), target :: tgt
type(string_container), pointer :: ptr
ptr => tgt
call set_ptr (ptr)
if (associated(ptr)) call abort()
contains
subroutine set_ptr (ptr)
type(string_container), pointer, intent(out) :: ptr
ptr => null ()
end subroutine set_ptr
end program main
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