Skip to content

Commit c76d11a

Browse files
TIFitisrlavaee
authored andcommitted
[Flang][OpenMP] Skip implicit mapping of named constants (llvm#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 ```
1 parent af15a77 commit c76d11a

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
@@ -2441,6 +2441,10 @@ genTargetOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
24412441
if (dsp.getAllSymbolsToPrivatize().contains(&sym))
24422442
return;
24432443

2444+
// Skip parameters/constants as they do not need to be mapped.
2445+
if (semantics::IsNamedConstant(sym))
2446+
return;
2447+
24442448
// These symbols are mapped individually in processHasDeviceAddr.
24452449
if (llvm::is_contained(hasDeviceAddrSyms, &sym))
24462450
return;

0 commit comments

Comments
 (0)