annotate gcc/testsuite/gfortran.dg/proc_ptr_19.f90 @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ! { dg-do run }
kono
parents:
diff changeset
2 !
kono
parents:
diff changeset
3 ! PR 40176: Fortran 2003: Procedure pointers with array return value
kono
parents:
diff changeset
4 !
kono
parents:
diff changeset
5 ! This example tests for a bug in procedure pointer assignments,
kono
parents:
diff changeset
6 ! where the rhs is a dummy.
kono
parents:
diff changeset
7 !
kono
parents:
diff changeset
8 ! Original test case by Barron Bichon <barron.bichon@swri.org>
kono
parents:
diff changeset
9 ! Modified by Janus Weil <janus@gcc.gnu.org>
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 PROGRAM test_prog
kono
parents:
diff changeset
12
kono
parents:
diff changeset
13 PROCEDURE(add), POINTER :: forig, fset
kono
parents:
diff changeset
14
kono
parents:
diff changeset
15 forig => add
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 CALL set_ptr(forig,fset)
kono
parents:
diff changeset
18
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
19 if (forig(1,2) /= fset(1,2)) STOP 1
111
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 CONTAINS
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 SUBROUTINE set_ptr(f1,f2)
kono
parents:
diff changeset
24 PROCEDURE(add), POINTER :: f1, f2
kono
parents:
diff changeset
25 f2 => f1
kono
parents:
diff changeset
26 END SUBROUTINE set_ptr
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 FUNCTION add(a,b)
kono
parents:
diff changeset
29 INTEGER :: a,b,add
kono
parents:
diff changeset
30 add = a+b
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 END FUNCTION add
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 END PROGRAM test_prog
kono
parents:
diff changeset
35