| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-fcoarray=single -Wall" } |
| 3 |
! |
| 4 |
! This program is perfectly valid; however, passing an (allocatable) coarray |
| 5 |
! as actual argument to a non-coarray allocatable dummy is doubtful as |
| 6 |
! reallocation is not allowed. Thus, an intent(out) dummy should be always |
| 7 |
! wrong. |
| 8 |
! |
| 9 |
|
| 10 |
integer, allocatable :: myCaf(:)[:] |
| 11 |
|
| 12 |
allocate(myCaf(1)[*]) |
| 13 |
|
| 14 |
call doubtful_valid(myCaf) ! { dg-warning "to allocatable, noncoarray dummy" } |
| 15 |
call invalid(myCaf) ! { dg-error "to allocatable, noncoarray, INTENT.OUT. dummy" } |
| 16 |
contains |
| 17 |
subroutine doubtful_valid(x) |
| 18 |
integer, allocatable :: x(:) |
| 19 |
! Valid as x's allocation status is not touched. |
| 20 |
x(1) = 7 |
| 21 |
end subroutine doubtful_valid |
| 22 |
subroutine invalid(y) |
| 23 |
integer, allocatable, intent(out) :: y(:) |
| 24 |
allocate (y(1)) |
| 25 |
end subroutine invalid |
| 26 |
end |