1! { dg-do run } 2! 3! Tests the fix for PR82275. 4! Associating a name with a reduced-dimension section of a 5! multidimensional array precluded subsequent use of the name 6! with the appropriately reduced dimensionality and instead 7! required use of the (invalid) full set of original dimensions. 8! 9! Contributed by Damian Rouson <damian@sourceryinstitute.org> 10! 11 type component 12 integer :: i 13 end type 14 type container 15 class(component), allocatable :: component_array(:,:) 16 end type 17 type(container) bag 18 type(component) section_copy 19 allocate(bag%component_array, source = reshape ([component(10), component (100)], [1,2])) 20 select type(associate_name=>bag%component_array(1,:)) 21 type is (component) 22 section_copy = associate_name(2) ! gfortran rejected valid 23! section_copy = associate_name(1,1)! gfortran accepted invalid 24 end select 25 if (section_copy%i .ne. 100) stop 1 26end 27