view gcc/testsuite/gfortran.dg/coarray_41.f90 @ 128:fe568345ddd5

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

! { dg-do run }
! { dg-options "-fcoarray=lib -lcaf_single" }
! { dg-additional-options "-latomic" { target libatomic_available } }

program coarray_41

  integer, allocatable :: vec(:)[:,:]

  allocate(vec(10)[2,*], source= 37)

  if (.not. allocated(vec)) error stop

  call foo(vec)

  if (any(vec /= 42)) error stop

  deallocate(vec)
contains

  subroutine foo(gv)

    integer, allocatable, intent(inout) :: gv(:)[:,:]
    integer, allocatable :: gvin(:)

    allocate(gvin, mold=gv)
    gvin = 5
    gv = gv + gvin
  end subroutine foo

end program coarray_41