| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-fdump-tree-original" } |
| 3 |
! PR fortran/100988 - RESTRICT was missing for optional arguments |
| 4 |
|
| 5 |
! There should be restrict qualifiers for a AND b: (4 cases) |
| 6 |
subroutine plain (a, b) |
| 7 |
integer :: a, b |
| 8 |
optional :: b |
| 9 |
end subroutine |
| 10 |
|
| 11 |
subroutine alloc (a, b) |
| 12 |
integer :: a, b |
| 13 |
allocatable :: a, b |
| 14 |
optional :: b |
| 15 |
end subroutine |
| 16 |
|
| 17 |
subroutine upoly (a, b) |
| 18 |
class(*) :: a, b |
| 19 |
optional :: b |
| 20 |
end subroutine |
| 21 |
|
| 22 |
subroutine upoly_a (a, b) |
| 23 |
class(*) :: a, b |
| 24 |
allocatable :: a, b |
| 25 |
optional :: b |
| 26 |
end subroutine |
| 27 |
|
| 28 |
! { dg-final { scan-tree-dump "plain .* restrict a, .* restrict b\\)" "original" } } |
| 29 |
! { dg-final { scan-tree-dump "alloc .* restrict a, .* restrict b\\)" "original" } } |
| 30 |
! { dg-final { scan-tree-dump "upoly .* restrict a, .* restrict b\\)" "original" } } |
| 31 |
! { dg-final { scan-tree-dump "upoly_a .* restrict a, .* restrict b\\)" "original" } } |
| 32 |
|
| 33 |
! There should be no restrict qualifiers for the below 4 cases: |
| 34 |
subroutine ptr (a, b) |
| 35 |
integer :: a, b |
| 36 |
pointer :: a, b |
| 37 |
optional :: b |
| 38 |
end subroutine |
| 39 |
|
| 40 |
subroutine tgt (a, b) |
| 41 |
integer :: a, b |
| 42 |
target :: a, b |
| 43 |
optional :: b |
| 44 |
end subroutine |
| 45 |
|
| 46 |
subroutine upoly_p (a, b) |
| 47 |
class(*) :: a, b |
| 48 |
pointer :: a, b |
| 49 |
optional :: b |
| 50 |
end subroutine |
| 51 |
|
| 52 |
subroutine upoly_t (a, b) |
| 53 |
class(*) :: a, b |
| 54 |
target :: a, b |
| 55 |
optional :: b |
| 56 |
end subroutine |
| 57 |
|
| 58 |
! { dg-final { scan-tree-dump-not "ptr .* restrict " "original" } } |
| 59 |
! { dg-final { scan-tree-dump-not "tgt .* restrict " "original" } } |
| 60 |
! { dg-final { scan-tree-dump-not "upoly_p .* restrict " "original" } } |
| 61 |
! { dg-final { scan-tree-dump-not "upoly_t .* restrict " "original" } } |