OSDN Git Service

PR debug/43329
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / proc_ptr_21.f90
1 ! { dg-do run }\r
2 ! Tests the fix for PR40591 in which the interface 'sub2'\r
3 ! for 'pptr2' was not resolved.\r
4 !\r
5 ! Contributed by Tobias Burnus  <burnus@gcc.gnu.org>\r
6 !\r
7 program main\r
8   call test\r
9 contains\r
10   subroutine sub1(arg)
11     integer arg
12     arg = arg + 1\r
13   end subroutine sub1\r
14   subroutine test()\r
15     procedure(sub1), pointer :: pptr1\r
16     procedure(sub2), pointer :: pptr2
17     integer i\r
18     i = 0\r
19     pptr1 => sub1
20     call pptr1 (i)\r
21     pptr1 => sub2
22     call pptr1 (i)\r
23     pptr2 => sub1
24     call pptr2 (i)\r
25     pptr2 => sub2
26     call pptr2 (i)
27     if (i .ne. 22) call abort\r
28   end subroutine test\r
29   subroutine sub2(arg)
30     integer arg
31     arg = arg + 10\r
32   end subroutine sub2\r
33 end program main\r