File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,17 @@ void AssignmentContext::Analyze(const parser::AssignmentStmt &stmt) {
9090 if (whereDepth_ > 0 ) {
9191 CheckShape (lhsLoc, &lhs);
9292 }
93+ if (context_.foldingContext ().languageFeatures ().IsEnabled (
94+ common::LanguageFeature::CUDA)) {
95+ const auto &scope{context_.FindScope (lhsLoc)};
96+ const Scope &progUnit{GetProgramUnitContaining (scope)};
97+ if (!IsCUDADeviceContext (&progUnit)) {
98+ if (Fortran::evaluate::HasCUDADeviceAttrs (lhs) &&
99+ Fortran::evaluate::HasCUDAImplicitTransfer (rhs)) {
100+ context_.Say (lhsLoc, " Unsupported CUDA data transfer" _err_en_US);
101+ }
102+ }
103+ }
93104 }
94105}
95106
Original file line number Diff line number Diff line change 1+ ! RUN: %python %S/test_errors.py %s %flang_fc1
2+
3+ subroutine sub1()
4+ real, allocatable, device :: a(:)
5+
6+ !ERROR: Unsupported CUDA data transfer
7+ a = a + 10 ! Illegal expression according to 3.4.2
8+ end subroutine
9+
10+
11+
You can’t perform that action at this time.
0 commit comments