program main
type A
integer x
end type
type, extends(A) :: B
integer :: y
end type
logical*4 :: mask(2,1,3)
type(A), pointer :: fV(:,:,:)
class(A), target, allocatable :: bT(:)
allocate(bT(12), source=(/ (B(i, i+1), i=1,12) /) )
fv(2:3, (0):0, 3:5) => bT(::2)
mask = reshape ( (/ .false., .false., .true., .true., &
.false., .false. /), (/ 2,1,3 /))
print*, sizeof(fv(1,1,1))
fv = unpack((/ A(101), A(-101) /), mask, fv)
end program
> a.out
4
fatal Fortran runtime error(t.f:23): UNPACK: VECTOR= has element byte length 4 but FIELD= has length 8
IOT/Abort trap(coredump)
All ifort, gfortran and XLF executed the code successfully.