llvm-project/flang/test/Evaluate/fold-arr-char-component.f90
Peter Klausler 73f9034036
[flang] Fix failure to fold character array (#123418)
When a character component reference is applied to a constant array of
derived type, ensure that the length of the resulting character array is
properly defined.

Fixes https://github.com/llvm/llvm-project/issues/123362.
2025-01-27 08:46:02 -08:00

12 lines
404 B
Fortran

! RUN: %python %S/test_folding.py %s %flang_fc1
! Ensure that array-valued component references have lengths
! (see https://github.com/llvm/llvm-project/issues/123362)
module m
type cdt
character(7) :: a = "ibm704", b = "cdc6600"
end type
type(cdt), parameter :: arr(2) = cdt()
integer, parameter :: check(*) = scan(arr%a, arr%b)
logical, parameter :: test1 = all(check == 5) ! the '0'
end