Debian Codegraph @

gcc/testsuite/gfortran.dg/associate_71.f90

raw
1 ! { dg-do run }
2 !
3 ! Check that pr117347 is fixed.
4 ! Contributed by Ivan Pribec <[email protected]>
5
6 program pr117347
7 implicit none
8
9 type :: point
10 real :: x = 42.
11 end type point
12
13 type(point) :: mypoint
14 real :: pi(1)
15 associate (points => mypoint )
16 pi(:) = points% x
17 end associate
18 if (any(pi /= 42)) stop 1
19 associate (points => (mypoint))
20 pi(:) = points% x
21 end associate
22 if (any(pi /= 42)) stop 2
23 associate (points => [mypoint])
24 pi(:) = points% x
25 end associate
26 if (any(pi /= 42)) stop 3
27 associate (points => [rpoint()])
28 pi(:) = points% x
29 end associate
30 if (any(pi /= 35)) stop 4
31
32 contains
33
34 function rpoint() result(r)
35 type(point) :: r
36 r%x = 35
37 end function
38 end program
39