https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125012
Bug ID: 125012
Summary: Associate with array expression of hidden type
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: ivan.pribec at gmail dot com
Target Milestone: ---
This is a variation of the issue in #117347, with the difference that the
derived type is hidden in the function (similar to #117077).
module mwe
implicit none
contains
function point() result(p)
type :: point_
real :: x = 42.
end type point_
type(point_) :: p
end function
end module
program assoc
use mwe, only: point
implicit none
real :: pi(1)
associate (points => point() ) ! accepted
pi(:) = points%x
end associate
print *, pi
associate (points => (point())) ! accepted
pi(:) = points%x
end associate
print *, pi
associate (points => [point()])
pi(:) = points%x ! REJECTED
end associate
print *, pi
end program
The compiler complaint is
mwe_assoc.f90:23:20:
23 | pi(:) = points% x
| 1
Error: Symbol 'points' at (1) has no IMPLICIT type
Works in flang, ifort, ifx, nvfortran, and nagfor with the following output:
> nagfor mwe_assoc.f90 && ./a.out
NAG Fortran Compiler Release 7.2(Shin-Urayasu) Build 7203
[NAG Fortran Compiler normal termination]
42.0000000
42.0000000
42.0000000