view gcc/testsuite/gfortran.dg/alloc_comp_basics_2.f90 @ 118:fd00160c1b76

ifdef TARGET_64BIT
author mir3636
date Tue, 27 Feb 2018 15:01:35 +0900
parents 04ced10e8804
children 84e7813d76e9
line wrap: on
line source

! { dg-do run }
! Check "double" allocations of allocatable components (PR 20541).
!
! Contributed by Erik Edelmann  <eedelmann@gcc.gnu.org>
!            and Paul Thomas  <pault@gcc.gnu.org>
!
program main

  implicit none

  type foo
     integer, dimension(:), allocatable :: array
  end type foo

  type(foo),allocatable,dimension(:) :: mol
  type(foo),pointer,dimension(:) :: molp
  integer :: i

  allocate (mol(1))
  allocate (mol(1), stat=i)
  !print *, i  ! /= 0
  if (i == 0) call abort()

  allocate (mol(1)%array(5))
  allocate (mol(1)%array(5),stat=i)
  !print *, i  ! /= 0
  if (i == 0) call abort()

  allocate (molp(1))
  allocate (molp(1), stat=i)
  !print *, i  ! == 0
  if (i /= 0) call abort()

  allocate (molp(1)%array(5))
  allocate (molp(1)%array(5),stat=i)
  !print *, i  ! /= 0
  if (i == 0) call abort()

end program main