https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123253
Bug ID: 123253
Summary: [16.0 regression] rejection of valid code
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: juergen.reuter at desy dot de
Target Milestone: ---
Created attachment 63119
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63119&action=edit
Code example, not yet a full reproducer
The problem is this code:
1593 module subroutine mci_vamp_instance_sample_grids &
1594 (instance, rng, sampler, eq)
1595 class(mci_vamp_instance_t), intent(inout), target :: instance
1596 class(rng_t), intent(inout) :: rng
1597 class(mci_sampler_t), intent(inout), target :: sampler
1598 type(vamp_equivalences_t), intent(in), optional :: eq
1599 class(vamp_data_t), allocatable :: data
1600 type(exception) :: vamp_exception
1601 allocate (mci_workspace_t :: data)
1602 select type (data)
1603 type is (mci_workspace_t)
1604 data%sampler => sampler
1605 data%instance => instance
1606 end select
1607 select type (rng)
mci_vamp_sub.f90:1604:8:
1602 | select type (data)
| 2
1603 | type is (mci_workspace_t)
1604 | data%sampler => sampler
| 1~~~~~~~~~~~
Error: Associate-name 'data' cannot appear in a variable definition context
(pointer assignment) at (1) because its target at (2) cannot, either
mci_vamp_sub.f90:1605:8:
1602 | select type (data)
| 2
......
1605 | data%instance => instance
| 1~~~~~~~~~~~~
Error: Associate-name 'data' cannot appear in a variable definition context
(pointer assignment) at (1) because its target at (2) cannot, either
mci_vamp_sub.f90:1245:11:
1243 | select type (data)
| 2
1244 | type is (mci_workspace_t)
1245 | data%sampler => sampler
| 1~~~~~~~~~~~
Error: Associate-name 'data' cannot appear in a variable definition context
(pointer assignment) at (1) because its target at (2) cannot, either
mci_vamp_sub.f90:1246:11:
1243 | select type (data)
| 2
......
1246 | data%instance => instance
| 1~~~~~~~~~~~~
Error: Associate-name 'data' cannot appear in a variable definition context
(pointer assignment) at (1) because its target at (2) cannot, either
mci_vamp_sub.f90:1203:11:
1201 | select type (data)
| 2
1202 | type is (mci_workspace_t)
1203 | data%sampler => sampler
| 1~~~~~~~~~~~
Error: Associate-name 'data' cannot appear in a variable definition context
(pointer assignment) at (1) because its target at (2) cannot, either
mci_vamp_sub.f90:1204:11:
1201 | select type (data)
| 2
......
1204 | data%instance => instance
| 1~~~~~~~~~~~~