summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_6.f90
blob: 8898a597d53ae48b10902c97103659ac9b70d79c (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
! { dg-do compile }
! { dg-options "-fcheck=bounds" }
!
! PR 42804: ICE with -fcheck=bounds and type bound procedure call on array element
!
! Contributed by Ian Harvey <ian_harvey@bigpond.com>

MODULE ModA
  IMPLICIT NONE
  TYPE, PUBLIC :: A
    PROCEDURE(a_proc),pointer :: Proc
  END TYPE A
CONTAINS
  SUBROUTINE a_proc(this, stat)
    CLASS(A), INTENT(INOUT) :: this
    INTEGER, INTENT(OUT) :: stat
    WRITE (*, *) 'a_proc'
    stat = 0
  END SUBROUTINE a_proc
END MODULE ModA

PROGRAM ProgA
  USE ModA
  IMPLICIT NONE
  INTEGER :: ierr
  INTEGER :: i
  TYPE(A), ALLOCATABLE :: arr(:)
  ALLOCATE(arr(2))
  DO i = 1, 2
    arr(i)%proc => a_proc
    CALL arr(i)%Proc(ierr)
  END DO
END PROGRAM ProgA

! { dg-final { cleanup-modules "ModA" } }