view gcc/testsuite/gfortran.dg/pr70673.f90 @ 128:fe568345ddd5

fix CbC-example
author mir3636
date Wed, 11 Apr 2018 19:32:28 +0900
parents 04ced10e8804
children 84e7813d76e9
line wrap: on
line source

! { dg-do run }
!
! 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")) call abort
    a = a(2:3)      ! Make sure that temporary creation is not broken.
    if ((len (a) .ne. 2) .or. (a .ne. "el")) call abort
    deallocate (a)
    a = a           ! This would ICE too.
  end subroutine s
end module m

  use m
  call s("hello")
end