forked from intel/llvm
-
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] Accept CLASS(*) array in EOSHIFT (#116114)
The intrinsic processing code wasn't allowing the ARRAY= argument to the EOSHIFT intrinsic function to be CLASS(*). That case seems to conform to the standard, although only one compiler could actually handle it, so allow for it. Fixes llvm/llvm-project#115923.
- Loading branch information
Showing
3 changed files
with
42 additions
and
20 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
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,22 @@ | ||
! RUN: %flang_fc1 -fsyntax-only -pedantic %s 2>&1 | FileCheck %s | ||
! Ensure that EOSHIFT's ARRAY= argument and result can be CLASS(*). | ||
! CHECK-NOT: error: | ||
! CHECK: warning: Source of TRANSFER is polymorphic | ||
! CHECK: warning: Mold of TRANSFER is polymorphic | ||
program p | ||
type base | ||
integer j | ||
end type | ||
type, extends(base) :: extended | ||
integer k | ||
end type | ||
class(base), allocatable :: polyArray(:,:,:) | ||
class(*), allocatable :: unlimited(:) | ||
allocate(polyArray, source=reshape([(extended(n,n-1),n=1,8)],[2,2,2])) | ||
allocate(unlimited, source=[(base(9),n=1,16)]) | ||
select type (x => eoshift(transfer(polyArray, unlimited), -4, base(-1))) | ||
type is (base); print *, 'base', x | ||
type is (extended); print *, 'extended?', x | ||
class default; print *, 'class default??' | ||
end select | ||
end |