c: Fix up pointer types to may_alias structures [PR114493]
[official-gcc.git] / gcc / testsuite / gfortran.dg / transfer_simplify_4.f90
blob480c93694fd3e0443078b3047cd3a48b5cd8510b
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) STOP 1
14 i = transfer(transfer(ip1, .true.), 0)
15 if (i .ne. ip1) STOP 2
17 i = 42
18 i = transfer(transfer(i, .true.), 0)
19 if (i .ne. ip1) STOP 3
21 b = transfer(transfer(.true., 3.1415), .true.)
22 if (.not.b) STOP 4
24 b = transfer(transfer(.false., 3.1415), .true.)
25 if (b) STOP 5
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)) STOP 1
36 ai = transfer (transfer ((/ 42, 42, 42, 42 /), &
37 & (/ .false., .false., .false., .false. /)), ai)
38 if (any(ai .ne. 42)) STOP 2
39 end