OSDN Git Service

PR testsuite/35406
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / derived_comp_array_ref_7.f90
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.
4 !
5 ! Reported by Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
6 !
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 ()
16
17 contains
18
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