https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103367
--- Comment #22 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
I have the following going with a draft patch. Is this what we are looking for?
The legacy extension stuff is noise. I could add implicit none or not use a
real as an index. Regardless, this plugs some holes. I noticed that when I was
backporting for PR60576, even though it applied OK, the same tests failed there
as failed here in comment #14. That suspicious even though the fix for pr60576
has nothing to do with this one. The patch that got me here is actually three
small ones I need to squash and cleanup yet.
subroutine s1
type t
integer :: a(1,2) = 3
end type
type(t), parameter :: x(1) = t(4)
integer, parameter :: y(1,2) = (x(1)%a(m,1)) ! { dg-error "does not reduce to
a constant expression" }
print *, y
end
subroutine s2
type t
integer :: a(2) = 3
end type
type(t), parameter :: x(1) = t(4)
integer, parameter :: y = x(1)%a(m) ! { dg-error "non-constant initialization
expression" }
print *, y
end
subroutine s3
type t
integer :: a(1,2) = 3
end type
type(t), parameter :: x(1) = t(4)
integer, parameter :: y(1,2) = (x(b)%a) ! { dg-error "does not reduce to a
constant expression" }
print *, y
end
subroutine s4
type t
integer :: a(1,2) = 3
end type
type(t), parameter :: x(1) = t(4)
integer :: y(1,2) = x(b)%a ! { dg-error "does not reduce to a constant
expression" }
print *, y
end
! { dg-prune-output "Legacy Extension: REAL array index" }