libgfortran/ChangeLog:
[official-gcc.git] / gcc / testsuite / gfortran.dg / proc_ptr_19.f90
bloba78a8d4643269ec838316990376d891cf7a00fac
1 ! { dg-do run }
3 ! PR 40176: Fortran 2003: Procedure pointers with array return value
5 ! This example tests for a bug in procedure pointer assignments,
6 ! where the rhs is a dummy.
8 ! Original test case by Barron Bichon <barron.bichon@swri.org>
9 ! Modified by Janus Weil <janus@gcc.gnu.org>
11 PROGRAM test_prog
13 PROCEDURE(add), POINTER :: forig, fset
15 forig => add
17 CALL set_ptr(forig,fset)
19 if (forig(1,2) /= fset(1,2)) call abort()
21 CONTAINS
23 SUBROUTINE set_ptr(f1,f2)
24 PROCEDURE(add), POINTER :: f1, f2
25 f2 => f1
26 END SUBROUTINE set_ptr
28 FUNCTION add(a,b)
29 INTEGER :: a,b,add
30 add = a+b
32 END FUNCTION add
34 END PROGRAM test_prog