coarray_41.f90: Add "-latomic" option if libatomic_available.
[official-gcc.git] / gcc / testsuite / gfortran.dg / proc_ptr_25.f90
blobcfa0d443478662e979b3a71219fe725c1f48ee71
1 ! { dg-do run }
3 ! PR 41139: [4.5 Regression] a procedure pointer call as actual argument
5 ! Original test case by Barron Bichon <barron.bichon@swri.org>
6 ! Modified by Janus Weil <janus@gcc.gnu.org>
8 PROGRAM test
10 PROCEDURE(add), POINTER :: f
11 logical :: g
13 ! Passing the function works
14 g=greater(4.,add(1.,2.))
15 if (.not. g) call abort()
17 ! Passing the procedure pointer fails
18 f => add
19 g=greater(4.,f(1.,2.))
20 if (.not. g) call abort()
22 CONTAINS
24 REAL FUNCTION add(x,y)
25 REAL, INTENT(in) :: x,y
26 print *,"add:",x,y
27 add = x+y
28 END FUNCTION add
30 LOGICAL FUNCTION greater(x,y)
31 REAL, INTENT(in) :: x, y
32 greater = (x > y)
33 END FUNCTION greater
35 END PROGRAM test