xref: /llvm-project/flang/test/Semantics/cuf02.cuf (revision 7c555cb2349b7f5f3b8336c40f38965aca354472)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2module m
3  interface
4    attributes(device) subroutine exts1
5    end
6  end interface
7 contains
8  recursive attributes(device) subroutine s1 ! ok
9  end
10  pure attributes(device) subroutine s2 ! ok
11  end
12  elemental attributes(device) subroutine s3 ! ok
13  end
14  subroutine s4
15   contains
16    !ERROR: A device subprogram may not be an internal subprogram
17    attributes(device) subroutine inner
18    end
19  end
20  attributes(device) subroutine s5 ! nvfortran crashes on this one
21   contains
22    !ERROR: 'inner' may not be an internal procedure of CUDA device subprogram 's5'
23    subroutine inner
24    end
25  end
26  attributes(device) subroutine s6
27    stmtfunc(x) = x + 1. ! ok
28  end
29  !ERROR: A function may not have ATTRIBUTES(GLOBAL) or ATTRIBUTES(GRID_GLOBAL)
30  attributes(global) real function f1
31  end
32  !ERROR: A kernel subprogram may not be RECURSIVE, PURE, or ELEMENTAL
33  recursive attributes(global) subroutine s7
34  end
35  !ERROR: A kernel subprogram may not be RECURSIVE, PURE, or ELEMENTAL
36  pure attributes(global) subroutine s8
37  end
38  !ERROR: A kernel subprogram may not be RECURSIVE, PURE, or ELEMENTAL
39  elemental attributes(global) subroutine s9
40  end
41  !ERROR: A kernel subprogram may not be RECURSIVE, PURE, or ELEMENTAL
42  recursive attributes(grid_global) subroutine s10
43  end
44  !ERROR: A kernel subprogram may not be RECURSIVE, PURE, or ELEMENTAL
45  pure attributes(grid_global) subroutine s11
46  end
47  !ERROR: A kernel subprogram may not be RECURSIVE, PURE, or ELEMENTAL
48  elemental attributes(grid_global) subroutine s12
49  end
50end
51
52attributes(device) subroutine exts1
53end
54