diff options
author | Andre Vehreschild <vehre@gcc.gnu.org> | 2015-10-25 14:02:32 +0100 |
---|---|---|
committer | Andre Vehreschild <vehre@gcc.gnu.org> | 2015-10-25 14:02:32 +0100 |
commit | f2f5814e592e9c99c321e9983fb8f82949bcc9ea (patch) | |
tree | b30749026e3253b2f80b5ac1ecbc292a374ab1ba | |
parent | b8ac4f3b22887143eec7e51497e95ff7301631df (diff) | |
download | gcc-f2f5814e592e9c99c321e9983fb8f82949bcc9ea.zip gcc-f2f5814e592e9c99c321e9983fb8f82949bcc9ea.tar.gz gcc-f2f5814e592e9c99c321e9983fb8f82949bcc9ea.tar.bz2 |
Added missing testcases of r229294 for patch of
PR fortran/66927.
From-SVN: r229295
-rw-r--r-- | gcc/testsuite/gfortran.dg/allocate_with_source_10.f08 | 51 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/allocate_with_source_11.f08 | 51 |
2 files changed, 102 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/allocate_with_source_10.f08 b/gcc/testsuite/gfortran.dg/allocate_with_source_10.f08 new file mode 100644 index 0000000..b9c68b4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/allocate_with_source_10.f08 @@ -0,0 +1,51 @@ +!{ dg-do run } +! +! Testcase for pr66927 +! Contributed by Juergen Reuter <juergen.reuter@desy.de> + +module processes + implicit none + private + + type :: t1_t + real :: p = 0.0 + end type t1_t + + type :: t2_t + private + type(t1_t), dimension(:), allocatable :: p + contains + procedure :: func => t2_func + end type t2_t + + type, public :: t3_t + type(t2_t), public :: int_born + end type t3_t + + public :: evaluate + +contains + + function t2_func (int) result (p) + class(t2_t), intent(in) :: int + type(t1_t), dimension(:), allocatable :: p + allocate(p(5)) + end function t2_func + + subroutine evaluate (t3) + class(t3_t), intent(inout) :: t3 + type(t1_t), dimension(:), allocatable :: p_born + allocate (p_born(1:size(t3%int_born%func ())), & + source = t3%int_born%func ()) + if (.not. allocated(p_born)) call abort() + if (size(p_born) /= 5) call abort() + end subroutine evaluate + +end module processes + +program pr66927 +use processes +type(t3_t) :: o +call evaluate(o) +end + diff --git a/gcc/testsuite/gfortran.dg/allocate_with_source_11.f08 b/gcc/testsuite/gfortran.dg/allocate_with_source_11.f08 new file mode 100644 index 0000000..5491b49 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/allocate_with_source_11.f08 @@ -0,0 +1,51 @@ +!{ dg-do run } +! +! Testcase for pr66927, pr67123 +! Contributed by Juergen Reuter <juergen.reuter@desy.de> + +module processes + implicit none + private + + type :: t1_t + real :: p = 0.0 + end type t1_t + + type :: t2_t + private + type(t1_t), dimension(:), allocatable :: p + contains + procedure :: func => t2_func + end type t2_t + + type, public :: t3_t + type(t2_t), public :: int_born + end type t3_t + + public :: evaluate + +contains + + function t2_func (int) result (p) + class(t2_t), intent(in) :: int + class(t1_t), dimension(:), allocatable :: p + allocate(p(5)) + end function t2_func + + subroutine evaluate (t3) + class(t3_t), intent(inout) :: t3 + type(t1_t), dimension(:), allocatable :: p_born + allocate (p_born(1:size(t3%int_born%func ())), & + source = t3%int_born%func ()) + if (.not. allocated(p_born)) call abort() + if (size(p_born) /= 5) call abort() + end subroutine evaluate + +end module processes + +program pr66927 +use processes +type(t3_t) :: o +call evaluate(o) +end + |