| ! RUN: %python %S/test_errors.py %s %flang_fc1 |
| ! CUDA Fortran section 2.5.6 restrictions |
| module m |
| contains |
| attributes(device) subroutine devsubr(n) |
| integer, intent(in) :: n |
| !WARNING: 'x1' should not have the SAVE attribute or initialization in a device subprogram |
| real, save :: x1 |
| !WARNING: 'x2' should not have the SAVE attribute or initialization in a device subprogram |
| real :: x2 = 1. |
| !ERROR: Device subprogram 'devsubr' cannot call itself |
| if (n > 0) call devsubr(n-1) |
| end subroutine |
| attributes(global) subroutine globsubr |
| end subroutine |
| subroutine boring |
| end subroutine |
| subroutine test |
| !ERROR: 'globsubr' is a kernel subroutine and must be called with kernel launch parameters in chevrons |
| call globsubr |
| !ERROR: Kernel launch parameters in chevrons may not be used unless calling a kernel subroutine |
| call boring<<<1,2>>> |
| end subroutine |
| end module |