https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85868
Bug ID: 85868
Summary: Subarray of a pointer array associated with a pointer
dummy argument
Product: gcc
Version: 7.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: vladimir.fuka at gmail dot com
Target Milestone: ---
Reported at
https://stackoverflow.com/questions/50459234/fortran-pointer-dummy-argument
This code returns
program aa
implicit none
real, pointer, dimension(:,:) :: t => null()
integer :: i,j
allocate(t(0:100,20))
do i = 0, 100
do j = 1, 20
t(i,j) = i*j
end do
end do
call te(t(1:,:))
contains
subroutine te(a)
real,dimension(:,:),pointer,intent(in) :: a
print *, a(1,1)
end subroutine te
end program aa
The code returns 4.0 In gfortran 4.8 to 7.3. It returns 1.0 in Oracle sunf90.
It is reported to be rejected by Intel Fortran 18:
/pt.f90(17): error #7121: A ptr dummy may only be argument associated with a
ptr, and this array element or section does not inherit the POINTER attr from
its parent array. [T]
call te(t(1:,:))
I don't know if this is related to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78290 or not.