Skip to content

Commit f19af90

Browse files
authored
[flang][cuda] Remove check for obsolete constraint (#70707)
The online CUDA Fortran documentation states that a device subprogram must be a top-level module subprogram, but this has turned out to be an obsolete constraint. Stop enforcing it.
1 parent ba177c7 commit f19af90

File tree

2 files changed

+0
-8
lines changed

2 files changed

+0
-8
lines changed

flang/lib/Semantics/check-declarations.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,12 +1394,6 @@ void CheckHelper::CheckSubprogram(
13941394
if (ClassifyProcedure(symbol) == ProcedureDefinitionClass::Internal) {
13951395
messages_.Say(symbol.name(),
13961396
"A device subprogram may not be an internal subprogram"_err_en_US);
1397-
} else if ((*cudaAttrs == common::CUDASubprogramAttrs::Device ||
1398-
*cudaAttrs == common::CUDASubprogramAttrs::HostDevice) &&
1399-
(symbol.owner().kind() != Scope::Kind::Module ||
1400-
details.isInterface())) {
1401-
messages_.Say(symbol.name(),
1402-
"An ATTRIBUTES(DEVICE) subprogram must be a top-level module procedure"_err_en_US);
14031397
}
14041398
}
14051399
if ((!details.cudaLaunchBounds().empty() ||

flang/test/Semantics/cuf02.cuf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
! RUN: %python %S/test_errors.py %s %flang_fc1
22
module m
33
interface
4-
!ERROR: An ATTRIBUTES(DEVICE) subprogram must be a top-level module procedure
54
attributes(device) subroutine exts1
65
end
76
end interface
@@ -44,6 +43,5 @@ module m
4443
end
4544
end
4645

47-
!ERROR: An ATTRIBUTES(DEVICE) subprogram must be a top-level module procedure
4846
attributes(device) subroutine exts1
4947
end

0 commit comments

Comments
 (0)