https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94578
--- Comment #7 from Jan-Willem Blokland <howisjw at hotmail dot com> ---
Thanks for verifying my case. Your test makes me wonder which intrinsics are
effected in this and other versions of gfortran. Furthermore, I assume it also
happens when you pass the pointer to subroutine or function (see example
below). This would be more difficult to debug. Fortunately, for my case the
pointer assignment and the usage of the intrinsic where in the same
function/subroutine.
program main
implicit none
type foo
integer :: x, y
end type foo
integer :: i
integer, dimension (2,2) :: array2d
integer, dimension(:), pointer :: array1d
type(foo), dimension(2*2), target :: solution
data array2d /1,3,2,4/
array1d => solution%x
array1d = reshape (source=array2d, shape=shape(array1d))
print *,maxval(array2d)
call printMaxval(array1d)
end program main
subroutine printMaxval(array1d)
implicit none
integer, dimension(:), intent(in) :: array1d
print*,maxval(array1d)
end subroutine