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

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Fri Apr 12 13:59:55 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))
----------------
klausler wrote:

Please use braces with all nested statement constructs like `if` in Semantics.

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


More information about the flang-commits mailing list