diff options
author | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
commit | 1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch) | |
tree | c607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gfortran.dg/coarray_15.f90 | |
parent | 283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff) | |
download | toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2 toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip |
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gfortran.dg/coarray_15.f90')
-rw-r--r-- | gcc-4.9/gcc/testsuite/gfortran.dg/coarray_15.f90 | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gfortran.dg/coarray_15.f90 b/gcc-4.9/gcc/testsuite/gfortran.dg/coarray_15.f90 new file mode 100644 index 000000000..ee01e61cc --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gfortran.dg/coarray_15.f90 @@ -0,0 +1,112 @@ +! { dg-do run } +! { dg-options "-fcoarray=single -Wzerotrip" } +! +! PR fortran/18918 +! +! Contributed by John Reid. +! +program ex2 + implicit none + real, allocatable :: z(:)[:] + integer :: image + character(len=128) :: str + + allocate(z(3)[*]) + write(*,*) 'z allocated on image',this_image() + sync all + if (this_image()==1) then + z = 1.2 + do image = 2, num_images() ! { dg-warning "will be executed zero times" } + write(*,*) 'Assigning z(:) on image',image + z(:)[image] = z + end do + end if + sync all + + str = repeat('X', len(str)) + write(str,*) 'z=',z(:),' on image',this_image() + if (str /= " z= 1.20000005 1.20000005 1.20000005 on image 1") & + call abort + + str = repeat('X', len(str)) + write(str,*) 'z=',z,' on image',this_image() + if (str /= " z= 1.20000005 1.20000005 1.20000005 on image 1") & + call abort + + str = repeat('X', len(str)) + write(str,*) 'z=',z(1:3)[this_image()],' on image',this_image() + if (str /= " z= 1.20000005 1.20000005 1.20000005 on image 1") & + call abort + + call ex2a() + call ex5() +end + +subroutine ex2a() + implicit none + real, allocatable :: z(:,:)[:,:] + integer :: image + character(len=128) :: str + + allocate(z(2,2)[1,*]) + write(*,*) 'z allocated on image',this_image() + sync all + if (this_image()==1) then + z = 1.2 + do image = 2, num_images() ! { dg-warning "will be executed zero times" } + write(*,*) 'Assigning z(:) on image',image + z(:,:)[1,image] = z + end do + end if + sync all + + str = repeat('X', len(str)) + write(str,*) 'z=',z(:,:),' on image',this_image() + if (str /= " z= 1.20000005 1.20000005 1.20000005 1.20000005 on image 1") & + call abort + + str = repeat('X', len(str)) + write(str,*) 'z=',z,' on image',this_image() + if (str /= " z= 1.20000005 1.20000005 1.20000005 1.20000005 on image 1") & + call abort +end subroutine ex2a + +subroutine ex5 + implicit none + integer :: me + real, save :: w(4)[*] + character(len=128) :: str + + me = this_image() + w = me + + str = repeat('X', len(str)) + write(str,*) 'In main on image',this_image(), 'w= ',w + if (str /= " In main on image 1 w= 1.00000000 1.00000000 1.00000000 1.00000000") & + call abort + + str = repeat('X', len(str)) + write(str,*) 'In main on image',this_image(), 'w= ',w(1:4) + if (str /= " In main on image 1 w= 1.00000000 1.00000000 1.00000000 1.00000000") & + call abort + + str = repeat('X', len(str)) + write(str,*) 'In main on image',this_image(), 'w= ',w(:)[1] + if (str /= " In main on image 1 w= 1.00000000 1.00000000 1.00000000 1.00000000") & + call abort + + sync all + call ex5_sub(me,w) +end subroutine ex5 + +subroutine ex5_sub(n,w) + implicit none + integer :: n + real :: w(n) + character(len=75) :: str + + str = repeat('X', len(str)) + write(str,*) 'In sub on image',this_image(), 'w= ',w + if (str /= " In sub on image 1 w= 1.00000000") & + call abort +end subroutine ex5_sub |