Skip to content

Commit 28e336f

Browse files
committed
[Flang][OpenMP] Skip implicit mapping of named constants
Added early return when mapping implicit variables for 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
1 parent 836ff36 commit 28e336f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2395,6 +2395,10 @@ genTargetOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
23952395
if (dsp.getAllSymbolsToPrivatize().contains(&sym))
23962396
return;
23972397

2398+
// Skip parameters/constants as they do not need to be mapped.
2399+
if (semantics::IsNamedConstant(sym))
2400+
return;
2401+
23982402
// These symbols are mapped individually in processHasDeviceAddr.
23992403
if (llvm::is_contained(hasDeviceAddrSyms, &sym))
24002404
return;

0 commit comments

Comments
 (0)