-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] Don't fold SIZE()/SHAPE() into expression referencing optiona…
…l dummy arguments When computing the shape of an expression at compilation time as part of folding an intrinsic function like SIZE(), don't create an expression that increases a dependence on the presence of an optional dummy argument. Differential Revision: https://reviews.llvm.org/D151737
- Loading branch information
Showing
2 changed files
with
29 additions
and
3 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,16 @@ | ||
! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s | ||
! Ensure that optional arguments aren't used to fold SIZE() or SHAPE() | ||
module m | ||
contains | ||
subroutine sub(x,y) | ||
real :: x(:), y(:) | ||
optional x | ||
!CHECK: PRINT *, int(size(y,dim=1,kind=8),kind=4) | ||
print *, size(f(x,y)) | ||
end | ||
elemental function f(x,y) | ||
real, intent(in) :: x, y | ||
optional x | ||
f = y | ||
end | ||
end |