diff --git a/flang/lib/Lower/ConvertExpr.cpp b/flang/lib/Lower/ConvertExpr.cpp index 76d810e9df6dc..8c2318632f725 100644 --- a/flang/lib/Lower/ConvertExpr.cpp +++ b/flang/lib/Lower/ConvertExpr.cpp @@ -2534,7 +2534,8 @@ class ScalarExprLowering { procRef.proc().GetSpecificIntrinsic()) return genIntrinsicRef(procRef, resultType, *intrinsic); - if (Fortran::lower::isIntrinsicModuleProcRef(procRef)) + if (Fortran::lower::isIntrinsicModuleProcRef(procRef) && + !Fortran::semantics::IsBindCProcedure(*procRef.proc().GetSymbol())) return genIntrinsicRef(procRef, resultType); if (isStatementFunctionCall(procRef)) diff --git a/flang/test/Lower/OpenMP/omp-lib-num-threads.f90 b/flang/test/Lower/OpenMP/omp-lib-num-threads.f90 index 01c3e93d97bfc..e1af7d375dfa5 100644 --- a/flang/test/Lower/OpenMP/omp-lib-num-threads.f90 +++ b/flang/test/Lower/OpenMP/omp-lib-num-threads.f90 @@ -1,5 +1,7 @@ ! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - 2>&1 | FileCheck %s ! RUN: bbc -fopenmp -emit-hlfir -o - %s 2>&1 | FileCheck %s +! RUN: %flang_fc1 -emit-fir -fopenmp %s -o - 2>&1 | FileCheck %s +! RUN: bbc -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s ! ! Test that the calls to omp_lib's omp_get_num_threads and omp_set_num_threads ! get lowered even though their implementation is not in the omp_lib module