Debian Codegraph @

gcc/testsuite/gfortran.dg/cray_pointers_13.f90

raw
1 ! { dg-do run }
2 ! { dg-additional-options "-fcray-pointer" }
3 !
4 ! PR fortran/106692 - Cray pointer comparison wrongly optimized away
5 !
6 ! Contributed by Marek Polacek
7
8 program test
9 call test_cray()
10 call test_cray2()
11 end
12
13 subroutine test_cray()
14 pointer(ptrzz1 , zz1)
15 ptrzz1=0
16 if (ptrzz1 .ne. 0) then
17 print *, "test_cray: ptrzz1=", ptrzz1
18 stop 1
19 else
20 call shape_cray(zz1)
21 end if
22 end
23
24 subroutine shape_cray(zz1)
25 pointer(ptrzz , zz)
26 ptrzz=loc(zz1)
27 if (ptrzz .ne. 0) then
28 print *, "shape_cray: ptrzz=", ptrzz
29 stop 3
30 end if
31 end
32
33 subroutine test_cray2()
34 pointer(ptrzz1 , zz1)
35 ptrzz1=0
36 if (0 == ptrzz1) then
37 call shape_cray2(zz1)
38 else
39 print *, "test_cray2: ptrzz1=", ptrzz1
40 stop 2
41 end if
42 end
43
44 subroutine shape_cray2(zz1)
45 pointer(ptrzz , zz)
46 ptrzz=loc(zz1)
47 if (.not. (0 == ptrzz)) then
48 print *, "shape_cray2: ptrzz=", ptrzz
49 stop 4
50 end if
51 end