http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46339
--- Comment #23 from david.sagan at gmail dot com 2010-11-19 21:24:01 UTC --- (In reply to comment #22) > > > Is there something invalid here? > > > > Yes. You need to allocate ptr unless you have > > pault's [re-]allocate on assignment patch. > > Even with Paul's patch it does not work. It works for me. The following two variants give the correct result (and this is without any patching): 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(4)) ptr = myA%i%j print *, " ptr =", ptr print *, " myA%i%j =", myA%i%j end program main 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' /) ptr => myA%i%j print *, " ptr =", ptr print *, " myA%i%j =", myA%i%j end program main Both give: ptr = 1 2 3 4 myA%i%j = 1 2 3 4