[Flang][OpenMP] Skip implicit mapping of named constants (#145966)

Added early return when mapping named constants.

This prevents linking error in the following example:

```
program test
   use, intrinsic :: iso_c_binding, only: c_double
   implicit none

   real(c_double) :: x
   integer        :: i
   x = 0.0_c_double
   !$omp target teams distribute parallel do reduction(+:x)
   do i = 0, 9
      x = x + 1.0_c_double
   end do
   !$omp end target teams distribute parallel do
end program test
```
This commit is contained in:
Akash Banerjee
2025-06-27 13:05:22 +01:00
committed by GitHub
parent c8ea114741
commit 91f10df794

View File

@@ -2441,6 +2441,10 @@ genTargetOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
if (dsp.getAllSymbolsToPrivatize().contains(&sym))
return;
// Skip parameters/constants as they do not need to be mapped.
if (semantics::IsNamedConstant(sym))
return;
// These symbols are mapped individually in processHasDeviceAddr.
if (llvm::is_contained(hasDeviceAddrSyms, &sym))
return;