File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -1470,6 +1470,13 @@ void CheckHelper::CheckSubprogram(
1470
1470
messages_.Say (symbol.name (),
1471
1471
" A function may not have ATTRIBUTES(GLOBAL) or ATTRIBUTES(GRID_GLOBAL)" _err_en_US);
1472
1472
}
1473
+ if (cudaAttrs &&
1474
+ (*cudaAttrs == common::CUDASubprogramAttrs::Global ||
1475
+ *cudaAttrs == common::CUDASubprogramAttrs::Grid_Global) &&
1476
+ symbol.attrs ().HasAny ({Attr::RECURSIVE, Attr::PURE, Attr::ELEMENTAL})) {
1477
+ messages_.Say (symbol.name (),
1478
+ " A kernel subprogram may not be RECURSIVE, PURE, or ELEMENTAL" _err_en_US);
1479
+ }
1473
1480
if (cudaAttrs && *cudaAttrs != common::CUDASubprogramAttrs::Host) {
1474
1481
// CUDA device subprogram checks
1475
1482
if (ClassifyProcedure (symbol) == ProcedureDefinitionClass::Internal) {
Original file line number Diff line number Diff line change @@ -29,11 +29,23 @@ module m
29
29
!ERROR: A function may not have ATTRIBUTES(GLOBAL) or ATTRIBUTES(GRID_GLOBAL)
30
30
attributes(global) real function f1
31
31
end
32
- recursive attributes(global) subroutine s7 ! ok
32
+ !ERROR: A kernel subprogram may not be RECURSIVE, PURE, or ELEMENTAL
33
+ recursive attributes(global) subroutine s7
33
34
end
34
- pure attributes(global) subroutine s8 ! ok
35
+ !ERROR: A kernel subprogram may not be RECURSIVE, PURE, or ELEMENTAL
36
+ pure attributes(global) subroutine s8
35
37
end
36
- elemental attributes(global) subroutine s9 ! ok
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
37
49
end
38
50
end
39
51
You can’t perform that action at this time.
0 commit comments