From f6541401407b0d09169fd716ab6d5e02c8d60642 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Wed, 27 Apr 2022 18:40:18 +0200 Subject: [PATCH] Split test to remove failing run time test and add check for ICE. gcc/testsuite/ChangeLog: PR fortran/70673 PR fortran/78054 * gfortran.dg/pr70673.f90: Remove invalid statement. * gfortran.dg/pr70673_2.f90: New test to check that ICE does not re-appear. --- gcc/testsuite/gfortran.dg/pr70673.f90 | 1 - gcc/testsuite/gfortran.dg/pr70673_2.f90 | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/pr70673_2.f90 diff --git a/gcc/testsuite/gfortran.dg/pr70673.f90 b/gcc/testsuite/gfortran.dg/pr70673.f90 index fa4bd2f..1449130 100644 --- a/gcc/testsuite/gfortran.dg/pr70673.f90 +++ b/gcc/testsuite/gfortran.dg/pr70673.f90 @@ -16,7 +16,6 @@ contains a = a(2:3) ! Make sure that temporary creation is not broken. if ((len (a) .ne. 2) .or. (a .ne. "el")) STOP 2 deallocate (a) - a = a ! This would ICE too. end subroutine s end module m diff --git a/gcc/testsuite/gfortran.dg/pr70673_2.f90 b/gcc/testsuite/gfortran.dg/pr70673_2.f90 new file mode 100644 index 0000000..ba2ce2f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr70673_2.f90 @@ -0,0 +1,25 @@ +! { dg-do compile } +! +! Test the fix for PR70673 +! +! Contributed by David Kinniburgh +! +module m +contains + subroutine s(inp) + character(*), intent(in) :: inp + character(:), allocatable :: a + a = a ! This used to ICE. + a = inp + a = a ! This used to ICE too + if ((len (a) .ne. 5) .or. (a .ne. "hello")) STOP 1 + a = a(2:3) ! Make sure that temporary creation is not broken. + if ((len (a) .ne. 2) .or. (a .ne. "el")) STOP 2 + deallocate (a) + a = a ! This would ICE too. + end subroutine s +end module m + + use m + call s("hello") +end -- 2.7.4