2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / assignment_1.f90
blob4022b0db989affcb103ba352e0e5a016a6023344
1 ! { dg-do run }
2 ! { dg-options -Wsurprising }
3 integer, pointer :: p
4 integer, target :: t, s
6 ! The tests for character pointers are currently commented out,
7 ! because they don't yet work correctly.
8 ! This is PR 17192
9 !!$character*5, pointer :: d
10 !!$character*5, target :: c, e
12 t = 1
13 p => s
14 ! We didn't dereference the pointer in the following line.
15 p = f() ! { dg-warning "POINTER-valued function" }
16 p = p+1
17 if (p.ne.2) call abort()
18 if (p.ne.s) call abort()
20 !!$! verify that we also dereference correctly the result of a function
21 !!$! which returns its result by reference
22 !!$c = "Hallo"
23 !!$d => e
24 !!$d = g() ! dg-warning "POINTER valued function" ""
25 !!$if (d.ne."Hallo") call abort()
27 contains
28 function f()
29 integer, pointer :: f
30 f => t
31 end function f
32 !!$function g()
33 !!$character, pointer :: g
34 !!$g => c
35 !!$end function g
36 end