]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gfortran.dg/array_constructor_type_10.f03
re PR fortran/27997 (Fortran 2003: Support type-spec for array constructor)
[thirdparty/gcc.git] / gcc / testsuite / gfortran.dg / array_constructor_type_10.f03
1 ! { dg-do run }
2 ! { dg-options "-fbounds-check" }
3 !
4 ! PR fortran/27997
5 !
6 ! Array constructor with typespec and dynamic
7 ! character length.
8 !
9 PROGRAM test
10 CALL foo(8, "short", "short")
11 CALL foo(2, "lenghty", "le")
12 CONTAINS
13 SUBROUTINE foo (n, s, shouldBe)
14 CHARACTER(len=*) :: s
15 CHARACTER(len=*) :: shouldBe
16 CHARACTER(len=16) :: arr(2)
17 INTEGER :: n
18 arr = [ character(len=n) :: s, s ]
19 IF (arr(1) /= shouldBe .OR. arr(2) /= shouldBe) THEN
20 CALL abort ()
21 END IF
22 END SUBROUTINE foo
23 END PROGRAM test