Debian Codegraph @

gcc/testsuite/gfortran.dg/assign_func_dtcomp_1.f90

raw
1 ! { dg-do run }
2 ! { dg-options "-O0" }
3 !
4 ! Test fix for PR18022.
5 !
6 ! Contributed by Paul Thomas <[email protected]>
7 !
8 program assign_func_dtcomp
9 implicit none
10 type :: mytype
11 real :: x
12 real :: y
13 end type mytype
14 type (mytype), dimension (4) :: z
15
16 type :: thytype
17 real :: x(4)
18 end type thytype
19 type (thytype) :: w
20 real, dimension (4) :: a = (/1.,2.,3.,4./)
21 real, dimension (4) :: b = (/5.,6.,7.,8./)
22
23
24 ! Test the original problem is fixed.
25 z(:)%x = foo (a)
26 z(:)%y = foo (b)
27
28
29 if (any(z%x.ne.a).or.any(z%y.ne.b)) STOP 1
30
31 ! Make sure we did not break anything on the way.
32 w%x(:) = foo (b)
33 a = foo (b)
34
35 if (any(w%x.ne.b).or.any(a.ne.b)) STOP 2
36
37 contains
38
39 function foo (v) result (ans)
40 real, dimension (:), intent(in) :: v
41 real, dimension (size(v)) :: ans
42 ans = v
43 end function foo
44
45
46 end program assign_func_dtcomp
47