diff options
author | Mikael Morin <mikael@gcc.gnu.org> | 2023-07-17 14:13:01 +0200 |
---|---|---|
committer | Mikael Morin <mikael@gcc.gnu.org> | 2023-07-17 14:13:01 +0200 |
commit | dee3518b7fed0cba45018bac1e4f4549e6ec69a2 (patch) | |
tree | cdd0d3f344ca1e2c6d48c4fdb89fb30ecb3ceada /gcc | |
parent | fb9ba7047740e29c15dc5c75bcec784b4a917abf (diff) | |
download | gcc-dee3518b7fed0cba45018bac1e4f4549e6ec69a2.zip gcc-dee3518b7fed0cba45018bac1e4f4549e6ec69a2.tar.gz gcc-dee3518b7fed0cba45018bac1e4f4549e6ec69a2.tar.bz2 |
fortran: Remove commented out assertion
r13-6747-gd7caf313525a46f200d7f5db1ba893f853774aee commented out an
assertion without any test exercising it. This adds such a test where
the assertion would fail, and removes the commented code.
gcc/fortran/ChangeLog:
* trans.cc (gfc_build_final_call): Remove commented assertion.
gcc/testsuite/ChangeLog:
* gfortran.dg/finalize_53.f90: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/trans.cc | 1 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/finalize_53.f90 | 34 |
2 files changed, 34 insertions, 1 deletions
diff --git a/gcc/fortran/trans.cc b/gcc/fortran/trans.cc index f1a3aac..387d66a 100644 --- a/gcc/fortran/trans.cc +++ b/gcc/fortran/trans.cc @@ -1126,7 +1126,6 @@ gfc_build_final_call (gfc_typespec ts, gfc_expr *final_wrapper, gfc_expr *var, else { gfc_conv_expr (&se, var); -// gcc_assert (se.pre.head == NULL_TREE && se.post.head == NULL_TREE); array = se.expr; /* No copy back needed, hence set attr's allocatable/pointer diff --git a/gcc/testsuite/gfortran.dg/finalize_53.f90 b/gcc/testsuite/gfortran.dg/finalize_53.f90 new file mode 100644 index 0000000..eeacb9e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/finalize_53.f90 @@ -0,0 +1,34 @@ +! { dg-do compile } +! +! Check that the data reference preliminary code is properly +! generated and accepted by the finalization handling code. + +module m + implicit none + type t + integer :: i + contains + final :: finalize_t + end type t + logical :: finalize_called = .false. +contains + subroutine finalize_t(a) + type(t) :: a + finalize_called = .true. + end subroutine finalize_t +end module m +program p + use m + type u + type(t), allocatable :: ta + end type u + class(u), allocatable :: c(:) + integer, allocatable :: a(:), b(:) + a = [1, 2, 3] + b = [3, 5, 1] + allocate(c, source = [u(t(1)), u(t(9))]) + deallocate(c(count(a + b == 4))%ta) + if (.not. allocated (c(1)%ta)) stop 11 + if (allocated (c(2)%ta)) stop 12 + if (.not. finalize_called) stop 13 +end program p |