xref: /llvm-project/flang/test/Semantics/cuf04.cuf (revision f674ddc19fee67401b78f360e530bb064aa31ed8)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2! CUDA Fortran section 2.5.6 restrictions
3module m
4 contains
5  attributes(device) subroutine devsubr(n)
6    integer, intent(in) :: n
7    !WARNING: 'x1' should not have the SAVE attribute or initialization in a device subprogram
8    real, save :: x1
9    !WARNING: 'x2' should not have the SAVE attribute or initialization in a device subprogram
10    real :: x2 = 1.
11    !ERROR: Device subprogram 'devsubr' cannot call itself
12    if (n > 0) call devsubr(n-1)
13  end subroutine
14  attributes(global) subroutine globsubr
15  end subroutine
16  subroutine boring
17  end subroutine
18  subroutine test
19    !ERROR: 'globsubr' is a kernel subroutine and must be called with kernel launch parameters in chevrons
20    call globsubr
21    !ERROR: Kernel launch parameters in chevrons may not be used unless calling a kernel subroutine
22    call boring<<<1,2>>>
23  end subroutine
24end module
25