1! { dg-do run } 2! 3! Checks the fix for PR67977 in which automatic reallocation on assignment 4! was performed when the lhs had a substring reference. 5! 6! Contributed by Anton Shterenlikht <mexas@bristol.ac.uk> 7! 8 character(:), allocatable :: z 9 integer :: length 10 z = "cockatoo" 11 length = len (z) 12 z(:) = '' 13 if (len(z) .ne. length) call abort 14 if (trim (z) .ne. '') call abort 15 z(:3) = "foo" 16 if (len(z) .ne. length) call abort 17 if (trim (z) .ne. "foo") call abort 18 z(4:) = "__bar" 19 if (len(z) .ne. length) call abort 20 if (trim (z) .ne. "foo__bar") call abort 21 deallocate (z) 22end 23