| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-w -std=legacy" } |
| 3 |
! |
| 4 |
! "-w" added as libgomp/testsuite seemingly cannot parse with |
| 5 |
! dg-warning Fortran's output. Fortran warns for "call sub1(a)" |
| 6 |
! that there is a "Rank mismatch in argument 'x'". |
| 7 |
|
| 8 |
SUBROUTINE SUB1(X) |
| 9 |
DIMENSION X(10) |
| 10 |
! This use of X does not conform to the |
| 11 |
! specification. It would be legal Fortran 90, |
| 12 |
! but the OpenMP private directive allows the |
| 13 |
! compiler to break the sequence association that |
| 14 |
! A had with the rest of the common block. |
| 15 |
FORALL (I = 1:10) X(I) = I |
| 16 |
END SUBROUTINE SUB1 |
| 17 |
PROGRAM A28_5 |
| 18 |
COMMON /BLOCK5/ A |
| 19 |
DIMENSION B(10) |
| 20 |
EQUIVALENCE (A,B(1)) |
| 21 |
! the common block has to be at least 10 words |
| 22 |
A=0 |
| 23 |
!$OMP PARALLEL PRIVATE(/BLOCK5/) |
| 24 |
! Without the private clause, |
| 25 |
! we would be passing a member of a sequence |
| 26 |
! that is at least ten elements long. |
| 27 |
! With the private clause, A may no longer be |
| 28 |
! sequence-associated. |
| 29 |
CALL SUB1(A) |
| 30 |
!$OMP MASTER |
| 31 |
PRINT *, A |
| 32 |
!$OMP END MASTER |
| 33 |
!$OMP END PARALLEL |
| 34 |
END PROGRAM A28_5 |