1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
|
! { dg-do compile }
SUBROUTINE foo(n,array)
IMPLICIT NONE
INTEGER, INTENT (IN) :: n
REAL, INTENT(INOUT),OPTIONAL:: array(:)
INTEGER:: i
!$OMP PARALLEL DO DEFAULT(none) SHARED(array,n) PRIVATE(i)
DO i = 1,n
IF (PRESENT(array)) THEN
array(i) = array(i) + i
ENDIF
ENDDO
!$OMP END PARALLEL DO
END SUBROUTINE foo
subroutine s1 (array)
real, optional :: array(:)
!$omp parallel default(none) firstprivate (array)
if (present (array)) array(:) = 3
!$omp end parallel
end subroutine
subroutine s2 (array)
real, optional :: array(:)
!$omp parallel default(none) shared (array)
!$omp master
if (present (array)) array(:) = 3
!$omp end master
!$omp end parallel
end subroutine
subroutine s3 (array)
real, optional :: array(:)
!$omp parallel default(none) private (array)
if (present (array)) array(:) = 3
!$omp end parallel
end subroutine
subroutine s4 (arg)
real, optional :: arg
!$omp parallel default(none) firstprivate (arg)
if (present (arg)) arg = 3
!$omp end parallel
end subroutine
subroutine s5 (arg)
real, optional :: arg
!$omp parallel default(none) shared (arg)
!$omp master
if (present (arg)) arg = 3
!$omp end master
!$omp end parallel
end subroutine
subroutine s6 (arg)
real, optional :: arg
!$omp parallel default(none) private (arg)
if (present (arg)) arg = 3
!$omp end parallel
end subroutine
subroutine s7 (arg)
real, value, optional :: arg
!$omp parallel default(none) firstprivate (arg)
if (present (arg)) arg = 3
!$omp end parallel
end subroutine
subroutine s8 (arg)
real, value, optional :: arg
!$omp parallel default(none) shared (arg)
!$omp master
if (present (arg)) arg = 3
!$omp end master
!$omp end parallel
end subroutine
subroutine s9 (arg)
real, value, optional :: arg
!$omp parallel default(none) private (arg)
if (present (arg)) arg = 3
!$omp end parallel
end subroutine
subroutine s10 (arg)
real, optional :: arg(..)
!$omp parallel default(none) private (arg)
if (present (arg)) stop 10
!$omp end parallel
end subroutine
subroutine w1 (array)
real, optional :: array(:)
!$omp parallel default(none) ! { dg-message "note: enclosing 'parallel'" }
if (.not.present (array)) stop 1 ! { dg-error "'array' not specified in enclosing 'parallel'" }
!$omp end parallel
end subroutine
subroutine w2 (array2)
real, optional :: array2(*)
!$omp parallel default(none) ! { dg-message "note: enclosing 'parallel'" "TODO" { xfail *-*-* } }
if (.not.present (array2)) stop 2 ! { dg-error "'array2' not specified in enclosing 'parallel'" "TODO" { xfail *-*-* } }
!$omp end parallel
end subroutine
subroutine w3 (arg)
real, optional :: arg
!$omp parallel default(none) ! { dg-message "note: enclosing 'parallel'" }
if (.not.present (arg)) stop 3 ! { dg-error "'arg' not specified in enclosing 'parallel'" }
!$omp end parallel
end subroutine
subroutine w4 (arg2)
real, value, optional :: arg2
!$omp parallel default(none) ! { dg-message "note: enclosing 'parallel" "TODO" { xfail *-*-* } }
if (.not.present (arg2)) stop 4 ! { dg-error "'arg2' not specified in enclosing 'parallel'" "TODO" { xfail *-*-*} }
!$omp end parallel
end subroutine
subroutine w5 (array3)
real, optional :: array3(..)
!$omp parallel default(none) ! { dg-message "note: enclosing 'parallel'" }
if (.not.present (array3)) stop 5 ! { dg-error "'array3' not specified in enclosing 'parallel'" }
!$omp end parallel
end subroutine
|