[flang-commits] [flang] [flang][cuda] Fix crash in semantic (PR #88577)

Valentin Clement バレンタイン クレメン via flang-commits flang-commits at lists.llvm.org
Fri Apr 12 14:01:53 PDT 2024


================
@@ -480,10 +480,15 @@ void CUDAChecker::Enter(const parser::CUFKernelDoConstruct &x) {
 }
 
 void CUDAChecker::Enter(const parser::AssignmentStmt &x) {
+  auto lhsLoc{std::get<parser::Variable>(x.t).GetSource()};
+  const auto &scope{context_.FindScope(lhsLoc)};
+  const Scope &progUnit{GetProgramUnitContaining(scope)};
+  if (IsCUDADeviceContext(&progUnit))
+    return; // Data transfer with assignment is only perform on host.
----------------
clementval wrote:

```suggestion
  if (IsCUDADeviceContext(&progUnit)) {
    return; // Data transfer with assignment is only perform on host.
  }
```

https://github.com/llvm/llvm-project/pull/88577


More information about the flang-commits mailing list