http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59781

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.0
            Summary|[4.9 Regression] [F03]      |[4.7/4.8/4.9 Regression]
                   |Incorrect initialisation of |[F03] Incorrect
                   |derived type                |initialisation of derived
                   |                            |type

--- Comment #3 from janus at gcc dot gnu.org ---
I verified that the problem is not specific to ISO_C_BINDING and occurs also
when replacing type(c_ptr) by some other derived type.

The following variant works with 4.4 (printing '1' as expected), but fails with
4.6 and above (printing some random number):


  implicit none

  type t1
    integer :: s
  end type

  type t2
    type(t1) :: state = t1(1)
    real, allocatable :: store(:)
  end type

  call test

contains

  subroutine test
    type(t2) :: rng
    print *,rng%state%s
  end subroutine

end

Reply via email to