https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102862
Bug ID: 102862
Summary: CLASS(*) – various issues, esp. with assumed-rank
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: diagnostic, rejects-valid
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Target Milestone: ---
The following program runs into various issues with CLASS handling in general
and CLASS(*) handling in particular. It compiles when using 'integer' but with
'class(*)' it fails with:
assumed-rank-class.f90:19:13:
19 | rank(*)
| 1
Error: Array pointer ‘__tmp_class___class__STAR_15_0t_rank_m1’ at (1) must have
a deferred shape or assumed rank
assumed-rank-class.f90:22:17:
22 | if (any(x(1:10) /= [(i, i=1,10)])) error stop
| 1
Error: Operands of comparison operator ‘/=’ at (1) are CLASS(*)/INTEGER(4)
assumed-rank-class.f90:5:14:
5 | call caller(A)
| 1
Error: Rank mismatch in argument ‘y’ at (1) (rank-3 and rank-1)
all of which are bogus.
implicit none
integer :: i
integer :: A(10)
A = [(i, i = 1, 10)]
call caller(A)
contains
subroutine caller(y)
class(*) :: y(5,-3:6,*)
!integer :: y(5,-3:6,*)
call foo(y)
end
subroutine foo(x)
class(*) :: x(..)
!integer :: x(..)
integer :: i
print *, rank(x)
print *, shape(x)
select rank(x)
rank(*)
print *,rank(x)
! OK - assumed size actual
if (any(x(1:10) /= [(i, i=1,10)])) error stop
rank default
error stop 1
end select
end subroutine
end