| 1 |
! PR fortran/79154 |
| 2 |
! { dg-do compile } |
| 3 |
|
| 4 |
pure real function foo (a, b) |
| 5 |
real, intent(in) :: a, b |
| 6 |
!$omp taskwait ! { dg-error "may not appear in a PURE" } |
| 7 |
foo = a + b |
| 8 |
end function foo |
| 9 |
pure function bar (a, b) |
| 10 |
real, intent(in) :: a(8), b(8) |
| 11 |
real :: bar(8) |
| 12 |
integer :: i |
| 13 |
!$omp do simd ! { dg-error "may not appear in a PURE" } |
| 14 |
do i = 1, 8 |
| 15 |
bar(i) = a(i) + b(i) |
| 16 |
end do |
| 17 |
end function bar |
| 18 |
pure function baz (a, b) |
| 19 |
real, intent(in) :: a(8), b(8) |
| 20 |
real :: baz(8) |
| 21 |
integer :: i |
| 22 |
!$omp do ! { dg-error "may not appear in a PURE" } |
| 23 |
do i = 1, 8 |
| 24 |
baz(i) = a(i) + b(i) |
| 25 |
end do |
| 26 |
!$omp end do ! { dg-error "may not appear in a PURE" } |
| 27 |
end function baz |
| 28 |
pure real function baz2 (a, b) |
| 29 |
real, intent(in) :: a, b |
| 30 |
!$omp target map(from:baz2) ! { dg-error "may not appear in a PURE" } |
| 31 |
baz2 = a + b |
| 32 |
!$omp end target ! { dg-error "may not appear in a PURE" } |
| 33 |
end function baz2 |
| 34 |
! ELEMENTAL implies PURE |
| 35 |
elemental real function fooe (a, b) |
| 36 |
real, intent(in) :: a, b |
| 37 |
!$omp taskyield ! { dg-error "may not appear in a PURE" } |
| 38 |
fooe = a + b |
| 39 |
end function fooe |
| 40 |
elemental real function baze (a, b) |
| 41 |
real, intent(in) :: a, b |
| 42 |
!$omp target map(from:baz) ! { dg-error "may not appear in a PURE" } |
| 43 |
baze = a + b |
| 44 |
!$omp end target ! { dg-error "may not appear in a PURE" } |
| 45 |
end function baze |
| 46 |
elemental impure real function fooei (a, b) |
| 47 |
real, intent(in) :: a, b |
| 48 |
!$omp taskyield ! { dg-bogus "may not appear in a PURE" } |
| 49 |
fooe = a + b |
| 50 |
end function fooei |
| 51 |
elemental impure real function bazei (a, b) |
| 52 |
real, intent(in) :: a, b |
| 53 |
!$omp target map(from:baz) ! { dg-bogus "may not appear in a PURE" } |
| 54 |
baze = a + b |
| 55 |
!$omp end target ! { dg-bogus "may not appear in a PURE" } |
| 56 |
end function bazei |