2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / derived_comp_array_ref_7.f90
blob890056589898636c666df0c15db78fa96150b669
1 ! { dg-do run }
2 ! Check the fix for PR32129 #4 in which the argument 'vec(vy(i, :))' was
3 ! incorrectly simplified, resulting in an ICE.
5 ! Reported by Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
7 program testCode
8 implicit none
9 type vec
10 real, dimension(2) :: coords
11 end type
12 integer :: i
13 real, dimension(2,2), parameter :: vy = reshape ((/1,2,3,4/),(/2,2/))
14 i = 1
15 if (any (foo(vec(vy(i, :))) /= vy(i, :))) call abort ()
17 contains
19 function foo (xin)
20 type(vec) :: xin
21 real, dimension (2) :: foo
22 intent(in) xin
23 foo = xin%coords
24 end function
25 end program