http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46339
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #21 from kargl at gcc dot gnu.org 2010-11-19 20:49:31 UTC ---
(In reply to comment #19)
> Is there something invalid here?
Yes. You need to allocate ptr unless you have
pault's [re-]allocate on assignment patch.
> module test
> implicit none
> type b
> integer :: j
> character :: c
> end type b
> type a
> type(b), dimension(4) :: i
> end type a
> end module test
>
> program main
> use test
> implicit none
> type(a), target :: myA
> integer, dimension(:), pointer :: ptr
> myA%i(1:4)%j = (/ 1, 2, 3, 4 /)
> myA%i(1:4)%c = (/ 'a', 'b', 'c', 'd' /)
allocate(ptr(size(myA%i)))
> ptr = myA%i%j
> print *, " ptr =", ptr
> print *, " myA%i%j =", myA%i%j
> end program main