+2009-10-05 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/41479
+ * trans-decl.c (init_intent_out_dt): Call gfc_init_default_dt
+ for all derived types with initializers.
+
2009-10-01 Tobias Burnus <burnus@net-b.de>
PR fortran/41515
&& !f->sym->attr.pointer
&& f->sym->ts.type == BT_DERIVED)
{
- if (f->sym->ts.derived->attr.alloc_comp)
+ if (f->sym->ts.derived->attr.alloc_comp && !f->sym->value)
{
tmp = gfc_deallocate_alloc_comp (f->sym->ts.derived,
f->sym->backend_decl,
gfc_add_expr_to_block (&fnblock, tmp);
}
-
- if (!f->sym->ts.derived->attr.alloc_comp
- && f->sym->value)
+ else if (f->sym->value)
body = gfc_init_default_dt (f->sym, body);
}
+2009-10-05 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/41479
+ * gfortran.dg/intent_out_5.f90: New test.
+
2009-10-01 Tobias Burnus <burnus@net-b.de>
PR fortran/41515
--- /dev/null
+! { dg-do run}
+!
+! PR fortran/41479
+!
+! Contributed by Juergen Reuter.
+!
+program main
+ type :: container_t
+ integer :: n = 42
+ ! if the following line is omitted, the problem disappears
+ integer, dimension(:), allocatable :: a
+ end type container_t
+
+ type(container_t) :: container
+
+ if (container%n /= 42) call abort()
+ if (allocated(container%a)) call abort()
+ container%n = 1
+ allocate(container%a(50))
+ call init (container)
+ if (container%n /= 42) call abort()
+ if (allocated(container%a)) call abort()
+contains
+ subroutine init (container)
+ type(container_t), intent(out) :: container
+ end subroutine init
+end program main