blob: 9a01a693f16e75d6127a37ddb6bb83b3e4e9fb53 [file] [edit]
! RUN: %python %S/../test_errors.py %s %flang_fc1
module m
interface
attributes(device) subroutine exts1
end
end interface
contains
recursive attributes(device) subroutine s1 ! ok
end
pure attributes(device) subroutine s2 ! ok
end
elemental attributes(device) subroutine s3 ! ok
end
subroutine s4
contains
!ERROR: A device subprogram may not be an internal subprogram
attributes(device) subroutine inner
end
end
attributes(device) subroutine s5 ! nvfortran crashes on this one
contains
!ERROR: 'inner' may not be an internal procedure of CUDA device subprogram 's5'
subroutine inner
end
end
attributes(device) subroutine s6
stmtfunc(x) = x + 1. ! ok
x = stmtfunc(x) ! ok
end
attributes(device) real function s6_declared(x)
implicit none
integer i, n
real conv, x, y
! Explicitly declared locals get ATTRIBUTES(DEVICE); statement functions
! are inlined, so CUDA data-attribute matching must not apply to dummies.
conv(i) = real(i)
n = 0
y = x - conv(n) ! ok
s6_declared = y
end
attributes(device) subroutine s6_bad
badstmt(x) = hostfunc(x)
!ERROR: 'hostfunc' may not be called in device code
x = badstmt(x)
end
!ERROR: A function may not have ATTRIBUTES(GLOBAL) or ATTRIBUTES(GRID_GLOBAL)
attributes(global) real function f1
end
!ERROR: A kernel subprogram may not be RECURSIVE, PURE, or ELEMENTAL
recursive attributes(global) subroutine s7
end
!ERROR: A kernel subprogram may not be RECURSIVE, PURE, or ELEMENTAL
pure attributes(global) subroutine s8
end
!ERROR: A kernel subprogram may not be RECURSIVE, PURE, or ELEMENTAL
elemental attributes(global) subroutine s9
end
!ERROR: A kernel subprogram may not be RECURSIVE, PURE, or ELEMENTAL
recursive attributes(grid_global) subroutine s10
end
!ERROR: A kernel subprogram may not be RECURSIVE, PURE, or ELEMENTAL
pure attributes(grid_global) subroutine s11
end
!ERROR: A kernel subprogram may not be RECURSIVE, PURE, or ELEMENTAL
elemental attributes(grid_global) subroutine s12
end
end
attributes(device) subroutine exts1
end