summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/pointer_function_actual_1.f90
blob: 0924117080c684ef8b75dd11f234eea8cd746d87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
! { dg-do run }
! { dg-options "-std=legacy" }
!
! Tests the fix for PR31209, in which an ICE would result because
! the reference to the pointer function f would be indirected, as
! if it were the result that is being passed.
!
! COntributed by Joost VandeVondele <jv244@cam.ac.uk>
!
FUNCTION F() RESULT(RES)
 INTEGER, POINTER :: RES
 ALLOCATE(RES)
 RES=2
END FUNCTION F

SUBROUTINE S1(f,*,*)
 INTERFACE
  FUNCTION F() RESULT(RES)
   INTEGER, POINTER :: RES
  END FUNCTION F
 END INTERFACE
 RETURN F()
END SUBROUTINE

PROGRAM TEST
   INTERFACE
    FUNCTION F() RESULT(RES)
     INTEGER, POINTER :: RES
    END FUNCTION F
   END INTERFACE


   INTERFACE
    SUBROUTINE S1(f,*,*)
      INTERFACE
       FUNCTION F() RESULT(RES)
        INTEGER, POINTER :: RES
       END FUNCTION F
      END INTERFACE
     END SUBROUTINE
   END INTERFACE

   CALL S1(F,*1,*2)

   1 CONTINUE
   CALL ABORT()

   GOTO 3
   2 CONTINUE

   3 CONTINUE
END