comparison gcc/testsuite/gfortran.dg/pointer_array_1.f90 @ 132:d34655255c78

update gcc-8.2
author mir3636
date Thu, 25 Oct 2018 10:21:07 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
130:e108057fa461 132:d34655255c78
20 if (switch .eq. 1) then 20 if (switch .eq. 1) then
21 values => d(:)%value 21 values => d(:)%value
22 if (any (values .ne. [1,2])) print *, values(2) 22 if (any (values .ne. [1,2])) print *, values(2)
23 else 23 else
24 values => d(:)%tag 24 values => d(:)%tag
25 if (any (values .ne. [101,102])) call abort 25 if (any (values .ne. [101,102])) STOP 1
26 end if 26 end if
27 END SUBROUTINE 27 END SUBROUTINE
28 28
29 function return_values(switch) result (values) 29 function return_values(switch) result (values)
30 INTEGER, POINTER :: values(:) 30 INTEGER, POINTER :: values(:)
31 integer :: switch 31 integer :: switch
32 TYPE(my_type), POINTER :: d(:) 32 TYPE(my_type), POINTER :: d(:)
33 allocate (d, source = [my_type(1,101), my_type(2,102)]) 33 allocate (d, source = [my_type(1,101), my_type(2,102)])
34 if (switch .eq. 1) then 34 if (switch .eq. 1) then
35 values => d(:)%value 35 values => d(:)%value
36 if (any (values .ne. [1,2])) call abort 36 if (any (values .ne. [1,2])) STOP 2
37 else 37 else
38 values => d(:)%tag 38 values => d(:)%tag
39 if (any (values([2,1]) .ne. [102,101])) call abort 39 if (any (values([2,1]) .ne. [102,101])) STOP 3
40 end if 40 end if
41 END function 41 END function
42 END MODULE 42 END MODULE
43 43
44 use test 44 use test
47 integer, pointer :: x(:) 47 integer, pointer :: x(:)
48 end type 48 end type
49 type(your_type) :: y 49 type(your_type) :: y
50 50
51 call get_values (x, 1) 51 call get_values (x, 1)
52 if (any (x .ne. [1,2])) call abort 52 if (any (x .ne. [1,2])) STOP 4
53 call get_values (y%x, 2) 53 call get_values (y%x, 2)
54 if (any (y%x .ne. [101,102])) call abort 54 if (any (y%x .ne. [101,102])) STOP 5
55 55
56 x => return_values (2) 56 x => return_values (2)
57 if (any (x .ne. [101,102])) call abort 57 if (any (x .ne. [101,102])) STOP 6
58 y%x => return_values (1) 58 y%x => return_values (1)
59 if (any (y%x .ne. [1,2])) call abort 59 if (any (y%x .ne. [1,2])) STOP 7
60 end 60 end