What do mean by “interesting result”? What gfortran prints here looks normal to me.
With gfortran 14, this snippet seems to be okay:
program test
implicit none
type :: mytype_t ( l )
integer, len :: l = 40
real :: arr(0:l-1)
end type
type(mytype_t), target :: a
real, pointer :: b(:)
a%arr(0) = 1.0
b => a%arr
print *, shape(b)
print *, lbound(b), ubound(b)
print *, b
end program
But if you try to print *, a%arr
directly there seems to be something wrong in the way the array is printed. After inspection with -fdump-tree-original
it uses:
_gfortran_transfer_array_write (&dt_parm.0, &a.arr, 4, 0);
whereas print *, b
is printed using _gfortran_transfer_real_write
.
Are you going to develop code using PDT with Gfortran, if in this case it seems to be ok ?
My choice has been for a more robust coding approach.
Unfortunately I have also taken a similar view with new features in OpenMP.