Skip to content

Commit f8c8722

Browse files
[flang][openmp] Fix not yet implemented intrinsic message for omp_lib (#71101)
PR#70386 removed hardcoded omp_lib name when checking if it is intrinsic module procedure reference - but instead relied on bind(c) to avoid generating error when the implementation is external to module. However, this change only worked for HLFIR. Make it work for FIR flow and update the test to exercise that as well.
1 parent 14f2025 commit f8c8722

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

flang/lib/Lower/ConvertExpr.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2534,7 +2534,8 @@ class ScalarExprLowering {
25342534
procRef.proc().GetSpecificIntrinsic())
25352535
return genIntrinsicRef(procRef, resultType, *intrinsic);
25362536

2537-
if (Fortran::lower::isIntrinsicModuleProcRef(procRef))
2537+
if (Fortran::lower::isIntrinsicModuleProcRef(procRef) &&
2538+
!Fortran::semantics::IsBindCProcedure(*procRef.proc().GetSymbol()))
25382539
return genIntrinsicRef(procRef, resultType);
25392540

25402541
if (isStatementFunctionCall(procRef))

flang/test/Lower/OpenMP/omp-lib-num-threads.f90

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - 2>&1 | FileCheck %s
22
! RUN: bbc -fopenmp -emit-hlfir -o - %s 2>&1 | FileCheck %s
3+
! RUN: %flang_fc1 -emit-fir -fopenmp %s -o - 2>&1 | FileCheck %s
4+
! RUN: bbc -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
35
!
46
! Test that the calls to omp_lib's omp_get_num_threads and omp_set_num_threads
57
! get lowered even though their implementation is not in the omp_lib module

0 commit comments

Comments
 (0)