-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] Represent (parentheses around derived types)
The strongly typed expression representation classes supported a representation of parentheses only around intrinsic types with specific kinds. Parentheses around derived type variables must also be preserved so that expressions may be distinguished from variables; this distinction matters for actual arguments & construct associations. Differential Revision: https://reviews.llvm.org/D110355
- Loading branch information
Showing
4 changed files
with
60 additions
and
6 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
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,34 @@ | ||
! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s | ||
! Ensures that parentheses are preserved with derived types | ||
module m | ||
type :: t | ||
integer :: n | ||
end type | ||
contains | ||
subroutine sub(x) | ||
type(t), intent(in) :: x | ||
end subroutine | ||
function f(m) | ||
type(t), pointer :: f | ||
integer, intent(in) :: m | ||
type(t), save, target :: res | ||
res%n = m | ||
f => res | ||
end function | ||
subroutine test | ||
type(t) :: x | ||
x = t(1) | ||
!CHECK: CALL sub(t(n=1_4)) | ||
call sub(t(1)) | ||
!CHECK: CALL sub((t(n=1_4))) | ||
call sub((t(1))) | ||
!CHECK: CALL sub(x) | ||
call sub(x) | ||
!CHECK: CALL sub((x)) | ||
call sub((x)) | ||
!CHECK: CALL sub(f(2_4)) | ||
call sub(f(2)) | ||
!CHECK: CALL sub((f(2_4))) | ||
call sub((f(2))) | ||
end subroutine | ||
end module |