Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gfortran.dg / transfer_simplify_4.f90
blob65b1e41cfdf727037f1d874f0897f7ece9a1396d
1 ! { dg-do run }
2 ! Tests that the in-memory representation of a transferred variable
3 ! propagates properly.
5 implicit none
7 integer, parameter :: ip1 = 42
8 integer, parameter :: ip2 = transfer(transfer(ip1, .true.), 0)
9 integer :: i, ai(4)
10 logical :: b
12 if (ip2 .ne. ip1) call abort ()
14 i = transfer(transfer(ip1, .true.), 0)
15 if (i .ne. ip1) call abort ()
17 i = 42
18 i = transfer(transfer(i, .true.), 0)
19 if (i .ne. ip1) call abort ()
21 b = transfer(transfer(.true., 3.1415), .true.)
22 if (.not.b) call abort ()
24 b = transfer(transfer(.false., 3.1415), .true.)
25 if (b) call abort ()
27 i = 0
28 b = transfer(i, .true.)
29 ! The standard doesn't guarantee here that b will be .false.,
30 ! though in gfortran for all targets it will.
32 ai = (/ 42, 42, 42, 42 /)
33 ai = transfer (transfer (ai, .false., 4), ai)
34 if (any(ai .ne. 42)) call abort
36 ai = transfer (transfer ((/ 42, 42, 42, 42 /), &
37 & (/ .false., .false., .false., .false. /)), ai)
38 if (any(ai .ne. 42)) call abort
39 end