forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] Fix failure to fold character array
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 llvm#123362.
- Loading branch information
Showing
2 changed files
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
! 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 |