1! { dg-do run }
2! { dg-options -Wsurprising }
3integer, pointer :: p
4integer, target :: t, s
5
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
11
12t = 1
13p => s
14! We didn't dereference the pointer in the following line.
15p = f() ! { dg-warning "POINTER-valued function" "" }
16p = p+1
17if (p.ne.2) call abort()
18if (p.ne.s) call abort()
19
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()
26
27contains
28function f()
29integer, pointer :: f
30f => t
31end function f
32!!$function g()
33!!$character, pointer :: g
34!!$g => c
35!!$end function g
36end
37