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.
This commit is contained in:
Thomas Koenig 2022-04-27 18:40:18 +02:00
parent a71b107013
commit f654140140
2 changed files with 25 additions and 1 deletions

View File

@ -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

View File

@ -0,0 +1,25 @@
! { dg-do compile }
!
! Test the fix for PR70673
!
! Contributed by David Kinniburgh <davidgkinniburgh@yahoo.co.uk>
!
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