OSDN Git Service

2010-04-06 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / derived_comp_array_ref_5.f90
1 ! { dg-do compile }
2 ! Tests the fix for PR33566, in which the first variable array ref
3 ! to v1 would cause an incompatible ranks error and the second an ICE.
4 !
5 ! Contributed by Mikael Morin <mikael.morin@tele2.fr>
6 !
7       program test_vec
8
9       implicit none
10
11
12       integer :: i
13       real    :: x
14
15       type vec3
16         real, dimension(3) :: coords
17       end type vec3
18
19       type(vec3),parameter :: v1 = vec3((/ 1.0, 2.0, 3.0 /))
20       type(vec3)           :: v2
21
22       v2 = vec3((/ 1.0, 2.0, 3.0 /))
23
24
25       x = v1%coords(1)
26
27       do i=1,3
28         x = v1%coords(i)  ! used to fail
29         x = v2%coords(i)
30       end do
31
32       i = 2
33
34       v2 = vec3 (v1%coords ((/i+1, i, i-1/))) ! also broken
35
36       end program test_vec