annotate gcc/testsuite/gfortran.dg/aliasing_dummy_4.f90 @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ! { dg-do run }
kono
parents:
diff changeset
2 ! This tests the fix for PR29315, in which array components of derived type arrays were
kono
parents:
diff changeset
3 ! not correctly passed to procedures because of a fault in the function that detects
kono
parents:
diff changeset
4 ! these references that do not have the span of a natural type.
kono
parents:
diff changeset
5 !
kono
parents:
diff changeset
6 ! Contributed by Stephen Jeffrey <stephen.jeffrey@nrm.qld.gov.au>
kono
parents:
diff changeset
7 !
kono
parents:
diff changeset
8 program test_f90
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 integer, parameter :: N = 2
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 type test_type
kono
parents:
diff changeset
13 integer a(N, N)
kono
parents:
diff changeset
14 end type
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 type (test_type) s(N, N)
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 forall (l = 1:N, m = 1:N) &
kono
parents:
diff changeset
19 s(l, m)%a(:, :) = reshape ([((i*l + 10*j*m +100, i = 1, N), j = 1, N)], [N, N])
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 call test_sub(s%a(1, 1), 1000) ! Test the original problem.
kono
parents:
diff changeset
22
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
23 if ( any (s(1, 1)%a(:, :) /= reshape ([1111, 112, 121, 122], [2, 2]))) STOP 1
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
24 if ( any (s(1, 2)%a(:, :) /= reshape ([1121, 122, 141, 142], [2, 2]))) STOP 2
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
25 if ( any (s(2, 1)%a(:, :) /= reshape ([1112, 114, 122, 124], [2, 2]))) STOP 3
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
26 if ( any (s(2, 2)%a(:, :) /= reshape ([1122, 124, 142, 144], [2, 2]))) STOP 4
111
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 call test_sub(s(1, 1)%a(:, :), 1000) ! Check "normal" references.
kono
parents:
diff changeset
29
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
30 if ( any (s(1, 1)%a(:, :) /= reshape ([2111,1112,1121,1122], [2, 2]))) STOP 5
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
31 if ( any (s(1, 2)%a(:, :) /= reshape ([1121, 122, 141, 142], [2, 2]))) STOP 6
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
32 if ( any (s(2, 1)%a(:, :) /= reshape ([1112, 114, 122, 124], [2, 2]))) STOP 7
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
33 if ( any (s(2, 2)%a(:, :) /= reshape ([1122, 124, 142, 144], [2, 2]))) STOP 8
111
kono
parents:
diff changeset
34 contains
kono
parents:
diff changeset
35 subroutine test_sub(array, offset)
kono
parents:
diff changeset
36 integer array(:, :), offset
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 forall (i = 1:N, j = 1:N) &
kono
parents:
diff changeset
39 array(i, j) = array(i, j) + offset
kono
parents:
diff changeset
40 end subroutine
kono
parents:
diff changeset
41 end program
kono
parents:
diff changeset
42