[flang-commits] [flang] [flang] Fix unused variable error (NFC) (PR #188358)

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Wed Mar 25 05:31:24 PDT 2026


================
@@ -535,10 +535,11 @@ void DataSharingProcessor::collectPrivatizedSymbols(
   };
 
   llvm::SetVector<const semantics::Scope *> clauseScopes;
-  const semantics::Scope *curScope = collectScopes(semaCtx, eval, clauseScopes);
+  [[maybe_unused]] const semantics::Scope *curScope =
+      collectScopes(semaCtx, eval, clauseScopes);
+  assert(curScope && "couldn't find current scope");
----------------
luporl wrote:

I agree with adding `[[maybe_unused]]` to `curScope`.

What I'm not sure is moving the `assert` out of the loop. In the past it would be hit in some cases, when out of the loop, with an asserts enabled flang.

Have you tried running gfortran/Fujitsu testsuites?

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


More information about the flang-commits mailing list