blob: 0b98d7f32c0bc6dcd9ab813ebeb8d62ff51fd048 [file] [edit]
! 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 [-Wcuda-usage]
real, save :: x1
!WARNING: 'x2' should not have the SAVE attribute or initialization in a device subprogram [-Wcuda-usage]
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 c_kernel() bind(c,name='c_kernel')
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>>>
call c_kernel<<<1,1>>>() ! ok because bind(c) subroutine
end subroutine
end module