view gcc/testsuite/gfortran.dg/coarray_allocate_2.f08 @ 128:fe568345ddd5

fix CbC-example
author mir3636
date Wed, 11 Apr 2018 19:32:28 +0900
parents 04ced10e8804
children 84e7813d76e9
line wrap: on
line source

! { dg-do run }
! { dg-options "-fcoarray=single" }
!
! Contributed by Ian Harvey  <ian_harvey@bigpond.com>
! Extended by Andre Vehreschild  <vehre@gcc.gnu.org>
! to test that coarray references in allocate work now
! PR fortran/67451

  program main
    implicit none
    type foo
      integer :: bar = 99
    end type
    class(foo), allocatable :: foobar[:]
    class(foo), allocatable :: some_local_object
    allocate(foobar[*])

    allocate(some_local_object, source=foobar)

    if (.not. allocated(foobar)) call abort()
    if (.not. allocated(some_local_object)) call abort()

    deallocate(some_local_object)
    deallocate(foobar)
  end program