| 1 |
! { dg-shouldfail "error directive" } |
| 2 |
|
| 3 |
module m |
| 4 |
implicit none (external, type) |
| 5 |
contains |
| 6 |
integer function foo (i, x) |
| 7 |
integer, value :: i, x |
| 8 |
if (x /= 0) then |
| 9 |
!$omp error severity(warning) ! { dg-warning ".OMP ERROR encountered at .1." } |
| 10 |
i = i + 1 |
| 11 |
end if |
| 12 |
if (x /= 0) then |
| 13 |
! ... |
| 14 |
else |
| 15 |
!$omp error severity(warning) ! { dg-warning ".OMP ERROR encountered at .1." } |
| 16 |
i = i + 2 |
| 17 |
end if |
| 18 |
select case(0) |
| 19 |
!$omp error severity(warning) ! { dg-warning ".OMP ERROR encountered at .1." } |
| 20 |
case default |
| 21 |
! |
| 22 |
end select |
| 23 |
do while (.false.) |
| 24 |
!$omp error message("42 - 1") severity (warning) ! { dg-warning ".OMP ERROR encountered at .1.: 42 - 1" } |
| 25 |
i = i + 4 |
| 26 |
end do |
| 27 |
99 continue |
| 28 |
!$omp error severity(warning) message("bar") at(compilation) ! { dg-warning ".OMP ERROR encountered at .1.: bar" } |
| 29 |
i = i + 8 |
| 30 |
foo = i |
| 31 |
end function |
| 32 |
end module |
| 33 |
|
| 34 |
program main |
| 35 |
use m |
| 36 |
implicit none (external, type) |
| 37 |
character(len=13) :: msg |
| 38 |
character(len=:), allocatable :: msg2, msg3 |
| 39 |
|
| 40 |
! Initialize offloading early, so that any output this may produce doesn't |
| 41 |
! disturb the 'dg-output' scanning below. |
| 42 |
!$omp target |
| 43 |
!$omp end target |
| 44 |
|
| 45 |
msg = "my message" |
| 46 |
if (foo (5, 0) /= 15 .or. foo (7, 1) /= 16) & |
| 47 |
stop 1 |
| 48 |
msg2 = "Paris" |
| 49 |
msg3 = "To thine own self be true" |
| 50 |
call bar ("Polonius", "Laertes", msg2, msg3) |
| 51 |
msg2 = "Hello World" |
| 52 |
!$omp error at (execution) severity (warning) |
| 53 |
!$omp error at (execution) severity (warning) message(trim(msg(4:))) |
| 54 |
!$omp error at (execution) severity (warning) message ("Farewell") |
| 55 |
!$omp target |
| 56 |
!$omp error at (execution) severity (warning) message ("ffrom a distanceee"(2:16)) |
| 57 |
!$omp end target |
| 58 |
!$omp error at (execution) severity (warning) message (msg2) |
| 59 |
!$omp error at (execution) severity (warning) message (msg(4:6)) |
| 60 |
!$omp error at (execution) severity (fatal) message (msg) |
| 61 |
! unreachable due to 'fatal'---------^ |
| 62 |
!$omp error at (execution) severity (warning) message ("foobar") |
| 63 |
contains |
| 64 |
subroutine bar(x, y, a, b) |
| 65 |
character(len=*) :: x, y |
| 66 |
character(len=:), allocatable :: a, b |
| 67 |
optional :: y, b |
| 68 |
intent(in) :: x, y, a, b |
| 69 |
!$omp error at (execution) severity (warning) message (x) |
| 70 |
!$omp error at (execution) severity (warning) message (y) |
| 71 |
!$omp error at (execution) severity (warning) message (a) |
| 72 |
!$omp error at (execution) severity (warning) message (b) |
| 73 |
end subroutine |
| 74 |
end |
| 75 |
|
| 76 |
! { dg-output "(\n|\r|\r\n)" } |
| 77 |
! { dg-output "libgomp: error directive encountered: Polonius(\n|\r|\r\n)(\n|\r|\r\n)" } |
| 78 |
! { dg-output "libgomp: error directive encountered: Laertes(\n|\r|\r\n)(\n|\r|\r\n)" } |
| 79 |
! { dg-output "libgomp: error directive encountered: Paris(\n|\r|\r\n)(\n|\r|\r\n)" } |
| 80 |
! { dg-output "libgomp: error directive encountered: To thine own self be true(\n|\r|\r\n)(\n|\r|\r\n)" } |
| 81 |
! { dg-output "libgomp: error directive encountered(\n|\r|\r\n)(\n|\r|\r\n)" } |
| 82 |
! { dg-output "libgomp: error directive encountered: message(\n|\r|\r\n)(\n|\r|\r\n)" } |
| 83 |
! { dg-output "libgomp: error directive encountered: Farewell(\n|\r|\r\n)(\n|\r|\r\n)" } |
| 84 |
! { dg-output "libgomp: error directive encountered: from a distance(\n|\r|\r\n)(\n|\r|\r\n)" } |
| 85 |
! { dg-output "libgomp: error directive encountered: Hello World(\n|\r|\r\n)(\n|\r|\r\n)" } |
| 86 |
! { dg-output "libgomp: error directive encountered: mes(\n|\r|\r\n)(\n|\r|\r\n)" } |
| 87 |
! { dg-output "libgomp: fatal error: error directive encountered: my message (\n|\r|\r\n)" } |