https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126895
Bug ID: 126895
Summary: Wrong IS_CONTIGUOUS result for pointer assumed-rank
scalar values
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: mikael at gcc dot gnu.org
Target Milestone: ---
IS_CONTIGUOUS returns a wrong value if its argument is a pointer assumed-rank
dummy associated with a scalar value. The function should always return True
in that case.
>From F2023, 16.9.115 IS_CONTIGUOUS(ARRAY):
The result has the value true if ARRAY has rank zero or is contiguous, and
false otherwise.
Testcase:
program prog
implicit none
type :: t
integer :: c1
end type
type, extends(t) :: u
integer :: c2
end type
type(t), target :: x
type(u), target :: y
call s1(x, 1)
call s1(y, 2)
contains
subroutine s1(a, e)
class(t), pointer, intent(in) :: a(..)
integer, value :: e
print *, is_contiguous(a)
!if (.not. is_contiguous(a)) error stop e
end subroutine
end program
The testcase gives at runtime:
F
F
The expected output is:
T
T