From 8fb75185a2179c98b35eb1db773acfaa6c42d90b Mon Sep 17 00:00:00 2001 From: Andre Vehreschild Date: Wed, 30 Nov 2016 16:59:07 +0100 Subject: single.c (_gfortran_caf_get_by_ref): Prevent compile time warning. libgfortran/ChangeLog: 2016-11-30 Andre Vehreschild * caf/single.c (_gfortran_caf_get_by_ref): Prevent compile time warning. (_gfortran_caf_send_by_ref): Same. (_gfortran_caf_is_present): Prevent fallthrough warnings. gcc/testsuite/ChangeLog: 2016-11-30 Andre Vehreschild * ChangeLog: Removed wrongly placed entry. * gfortran.dg/coarray_lib_alloc_4.f90: New test. From-SVN: r243034 --- gcc/testsuite/ChangeLog | 10 ++--- gcc/testsuite/gfortran.dg/coarray_lib_alloc_4.f90 | 46 +++++++++++++++++++++++ 2 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/coarray_lib_alloc_4.f90 (limited to 'gcc') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e9c37c9..c1ab201 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-11-30 Andre Vehreschild + + Now really add the file. + * gfortran.dg/coarray_lib_alloc_4.f90: New test. + 2016-11-30 David Edelsohn * g++.dg/eh/new1.C: XFAIL on AIX. @@ -35,11 +40,6 @@ 2016-11-30 Andre Vehreschild - * caf/single.c (_gfortran_caf_is_present): Prevent fallthrough - warnings. - -2016-11-30 Andre Vehreschild - * gfortran.dg/coarray/alloc_comp_1.f90: Fix tree-dump scans to adhere to the changed interfaces. * gfortran.dg/coarray_alloc_comp_1.f08: Likewise. diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_alloc_4.f90 b/gcc/testsuite/gfortran.dg/coarray_lib_alloc_4.f90 new file mode 100644 index 0000000..aea9fbf --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_lib_alloc_4.f90 @@ -0,0 +1,46 @@ +! { dg-do run } +! { dg-options "-fcoarray=lib -lcaf_single -fdump-tree-original" } +! +! Allocate/deallocate with libcaf. +! + +program test_caf_alloc + + type t + integer, allocatable :: i + real, allocatable :: r(:) + end type t + + type(t), allocatable :: xx[:] + + allocate (xx[*]) + + if (allocated(xx%i)) call abort() + if (allocated(xx[1]%i)) call abort() + if (allocated(xx[1]%r)) call abort() + allocate(xx%i) + if (.not. allocated(xx[1]%i)) call abort() + if (allocated(xx[1]%r)) call abort() + + allocate(xx%r(5)) + if (.not. allocated(xx[1]%i)) call abort() + if (.not. allocated(xx[1]%r)) call abort() + + deallocate(xx%i) + if (allocated(xx[1]%i)) call abort() + if (.not. allocated(xx[1]%r)) call abort() + + deallocate(xx%r) + if (allocated(xx[1]%i)) call abort() + if (allocated(xx[1]%r)) call abort() + + deallocate(xx) +end + +! { dg-final { scan-tree-dump-times "_gfortran_caf_is_present \\(xx\\.token, 2 - \\(integer\\(kind=4\\)\\) xx\\.dim\\\[0\\\]\\.lbound, &caf_ref\\.\[0-9\]+\\)|_gfortran_caf_is_present \\(xx\\.token, 2 - xx\\.dim\\\[0\\\]\\.lbound, &caf_ref\\.\[0-9\]+\\)" 10 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(72, 1, &xx\\.token, \\(void \\*\\) &xx, 0B, 0B, 0\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(\[0-9\]+, 7" 2 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(\[0-9\]+, 8" 2 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister \\(&xx\\.token, 0, 0B, 0B, 0\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister \\(&\\(\\(struct t \\* restrict\\) xx\\.data\\)->r\\.token, 1, 0B, 0B, 0\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister \\(&\\(\\(struct t \\* restrict\\) xx\\.data\\)->_caf_i, 1, 0B, 0B, 0\\)" 1 "original" } } -- cgit v1.1