view gcc/testsuite/gfortran.dg/realloc_on_assign_25.f90 @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 84e7813d76e9
children
line wrap: on
line source

! { dg-do run }
! PR 47674 - this would segfault if MALLOC_PERTURB is set.
! This checks a code path where it is not possible to determine
! the length of the string at compile time.
!
program main
  implicit none
  character(:), allocatable :: a
  integer :: m, n
  a = 'a'
  if (a .ne. 'a') STOP 1
  a = a // 'x'
  if (a .ne. 'ax') STOP 2
  if (len (a) .ne. 2) STOP 3
  n = 2
  m = 2
  a = a(m:n)
  if (a .ne. 'x') STOP 4
  if (len (a) .ne. 1) STOP 5
end program main