https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114474
Bug ID: 114474
Summary: [11/12/13/14 Regression] DATA statement with derived
type, pointer component rejected
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: anlauf at gcc dot gnu.org
Target Milestone: ---
While working on pr50410, I noticed that the following code works with
gfortran <= 9.5.0, but fails with 10.5.0 and higher:
program p
implicit none
integer, target :: zz = 42 ! initial data target
type t
integer, pointer :: h
end type t
type(t) :: x, y
data x / t(null()) / ! OK
data y / t(zz) / ! fails starting with gcc-10
if (associated (y% h)) print *, y% h
end
This works with NAG and older gfortran and prints "42".
Current mainline gives:
pr50410_ctor.f90:9:13:
9 | data y / t(zz) / ! fails starting with gcc-10
| 1
Error: The element in the structure constructor at (1), for pointer component
'h', is PROCEDURE but should be INTEGER