From: Andre Vehreschild Date: Sun, 25 Oct 2015 13:02:32 +0000 (+0100) Subject: Added missing testcases of r229294 for patch of X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f2f5814e592e9c99c321e9983fb8f82949bcc9ea;p=gcc.git Added missing testcases of r229294 for patch of PR fortran/66927. From-SVN: r229295 --- 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 00000000000..b9c68b4b45b --- /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 + +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 00000000000..5491b49218d --- /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 + +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 +