1! { dg-do run }
2
3! PR fortran/49885
4! Check that character arrays with non-constant char-length are handled
5! correctly.
6
7! Contributed by Daniel Kraft <d@domob.eu>,
8! based on original test case and variant by Tobias Burnus in comment 2.
9
10PROGRAM main
11  IMPLICIT NONE
12
13  CALL s (10)
14
15CONTAINS
16
17  SUBROUTINE s (nb)
18    INTEGER :: nb
19    CHARACTER(MAX (80, nb)) :: bad_rec(1)
20
21    bad_rec(1)(1:2) = 'abc'
22    IF (bad_rec(1)(1:2) /= 'ab') STOP 1
23  END SUBROUTINE s
24
25END PROGRAM main
26