[Patch, fortran] PR29396 PR29606 PR30625 and PR30871 - subreference array pointers.
Paul Richard Thomas
paul.richard.thomas@gmail.com
Sat Sep 15 14:47:00 GMT 2007
I am glad to report that in spite of ignoring WHERE and FORALL masks,
the above patch works quite well with them!
This is an indication of how powerful these features can be when used together:
type :: t
logical :: flag
real :: value
end type
type(t), target :: tar(3)
logical, pointer :: lptr(:)
real, pointer :: rptr(:)
tar = (/t(.true., 1.0), t(.false., 3.0), t(.false., 7.0)/)
lptr => tar%flag
rptr => tar%value
print *, "initial values ", rptr
forall (i = 1:3, lptr(i)) rptr(i) = 42.0
forall (i = 1:3, .not.lptr(i)) rptr(i) = 0.0
print *, "after FORALL ", rptr
where (.not.lptr)
rptr = 77.0
elsewhere
rptr = 99.0
endwhere
print *, "after WHERE ", rptr
end
Cheers
Paul
More information about the Fortran
mailing list