summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_19.f90
blob: 8cc1601d047ca89bec9d77f6e9734df52fbfcd34 (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
! { dg-do run }
! This testcase failed before with optimization as
! allocatef's CFI descriptor argument 'x' failed with -fstrict-alias due to
! internally alising with the GFC descriptor
!

program testit
  use iso_c_binding
  implicit none (external, type)
  type, bind (c) :: m
    integer(C_INT) :: i, j
  end type
  type(m), allocatable :: a(:)

  call testf (a)

contains
  subroutine allocatef (x) bind (c)
    type(m), allocatable :: x(:)
    allocate (x(5:15))
  end subroutine

  subroutine testf (y)
    type(m), allocatable, target :: y(:)
    call allocatef (y)
    if (.not. allocated (y))  stop 1
  end subroutine
end program