| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-fcoarray=lib" } |
| 3 |
! PR fortran/102458 - standard intrinsics excluded in constant expressions |
| 4 |
|
| 5 |
subroutine s1 |
| 6 |
integer :: a(command_argument_count()) = 1 ! { dg-error "Automatic array" } |
| 7 |
print *, a |
| 8 |
end |
| 9 |
|
| 10 |
program p |
| 11 |
block |
| 12 |
integer :: a(get_team()) = 1 ! { dg-error "Automatic array" } |
| 13 |
print *, a |
| 14 |
end block |
| 15 |
end |
| 16 |
|
| 17 |
subroutine s2 |
| 18 |
integer :: a(num_images()) = 1 ! { dg-error "Automatic array" } |
| 19 |
print *, a |
| 20 |
end |
| 21 |
|
| 22 |
function f() |
| 23 |
block |
| 24 |
integer :: a(team_number()) = 0 ! { dg-error "Automatic array" } |
| 25 |
a = 1 |
| 26 |
end block |
| 27 |
end |
| 28 |
|
| 29 |
subroutine s3 |
| 30 |
integer :: a(this_image()) = 1 ! { dg-error "Automatic array" } |
| 31 |
print *, a |
| 32 |
end |
| 33 |
|
| 34 |
subroutine s4 |
| 35 |
integer, parameter :: n = 4 |
| 36 |
integer, parameter :: x(transfer(n, n)) = 1 ! legal |
| 37 |
integer :: y(transfer(n, n)) = 2 ! legal |
| 38 |
integer, parameter :: k = size (x) ! ok |
| 39 |
! integer, parameter :: m = size (y) ! fails, tracked separately |
| 40 |
print *, k, x, y |
| 41 |
if (k /= size (y)) stop 1 |
| 42 |
end |