[flang-commits] [flang] [llvm] [flang][OpenMP] Fix mapping of constant arrays. (PR #176763)

Abid Qadeer via flang-commits flang-commits at lists.llvm.org
Tue Jan 20 06:01:49 PST 2026


================
@@ -2657,8 +2662,10 @@ genTargetOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
     if (!converter.getSymbolAddress(sym))
       return;
 
-    // Skip parameters/constants as they do not need to be mapped.
-    if (semantics::IsNamedConstant(sym))
+    // Skip scalar parameters/constants as they do not need to be mapped.
+    // However, parameter arrays must be mapped as they may be accessed with
+    // dynamic indices on the device (e.g., const_array(runtime_index)).
+    if (semantics::IsNamedConstant(sym) && sym.Rank() == 0)
----------------
abidh wrote:

Thanks for pointing that out. I have added code to check that and updated the test accordingly. Please let me know if that addresses your concern.

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


More information about the flang-commits mailing list