Dear all, Thanks for all your replies! I think I found another solution to problem. I am by no means a Fortran standards expert, but it seems to run with PGI, Cray and GNU compilers... subroutine get_ptr(p,var,nx,ny,nz) real, pointer :: p(:,:,:) integer :: nx,ny,nz real, target :: var(nx,ny,nz) p => var end subroutine get_ptr program test real, target :: a(3,4,5), b(3,4) real, pointer :: p(:,:,:) call get_ptr(p,a,3,4,5) call get_ptr(p,b,3,4,1) end program test Any comments are appreciated! Cheers, Oli > -----Original Message----- > From: Fortran 90 List [mailto:[log in to unmask]] On > Behalf Of Malcolm Cohen > Sent: Donnerstag, 12. April 2012 06:17 > To: [log in to unmask] > Subject: Re: 3d pointer to 2d target > > I wrote: > > Well then, you could do it the other way around: > > Real,Target :: p(30,40,1) > > Real,Pointer :: a(:,:) > > a => a3(:,:,1) > > That last line should have been > a=>p(:,:,1) > > > Or if sometimes you want p to point to a, and sometimes to something else > > > > Real,Target :: a3(30,40,1) > > Real,Pointer :: a(:,:),p(:,:,:) > > a => a3(:,:,1) > > p => a3 > > Cheers, > -- > ................................Malcolm Cohen, Nihon NAG, Tokyo.