llvm-project/flang/test/Parser/decl-char-length.f90
Peter Klausler 8115454aa0
[flang] Extension: accept "var*length(bounds)" (#117399)
A character length specifier in an entity declaration or a component
declaration is required by the standard to follow any array bounds or
coarray bounds that are present. Several Fortran compilers allow the
character length specifier to follow the name and appear before the
bounds.

Fixes https://github.com/llvm/llvm-project/issues/117372.
2024-12-02 12:25:47 -08:00

18 lines
442 B
Fortran

! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s
! Test parsing of alternative order of char-length in an
! entity-decl or component-decl.
program p
type t
!CHECK: CHARACTER c1(2_4)*3/"abc", "def"/
character c1*3(2)/'abc','def'/
end type
integer, parameter :: n=3
!CHECK: CHARACTER v1(2_4)*(3_4)/"ghi", "jkl"/
character v1*(n)(2)/'ghi','jkl'/
!CHECK: CHARACTER :: v2(1_4)*2 = "mn"
character::v2*2(1)='mn'
end