[Openmp-commits] [openmp] [OpenMP] Fix issue of indirect function call in `__kmpc_fork_call_if` (PR #65436)

Shilei Tian via Openmp-commits openmp-commits at lists.llvm.org
Wed Sep 6 20:41:31 PDT 2023


shiltian wrote:

> Seeing the following compilation errors with this change:
> 
> ```
> FAILED: openmp/runtime/src/CMakeFiles/omp.dir/kmp_csupport.cpp.o
> ...
> /work1/omp-nightly/build/git/trunk17.0/llvm-project/openmp/runtime/src/kmp_csupport.cpp:359:7: error: no matching function for call to '__kmp_invoke_microtask'
>   359 |       __kmp_invoke_microtask(VOLATILE_CAST(microtask_t) microtask, gtid,
>       |       ^~~~~~~~~~~~~~~~~~~~~~
> /work1/omp-nightly/build/git/trunk17.0/llvm-project/openmp/runtime/src/kmp.h:4037:12: note: candidate function not viable: requires 5 arguments, but 6 were provided
>  4037 | extern int __kmp_invoke_microtask(microtask_t pkfn, int gtid, int npr, int argc,
>       |            ^                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  4038 |                                   void *argv[]
>       |                                   ~~~~~~~~~~~~
> /work1/omp-nightly/build/git/trunk17.0/llvm-project/openmp/runtime/src/kmp_csupport.cpp:368:7: error: no matching function for call to '__kmp_invoke_microtask'
>   368 |       __kmp_invoke_microtask(VOLATILE_CAST(microtask_t) microtask, gtid,
>       |       ^~~~~~~~~~~~~~~~~~~~~~
> /work1/omp-nightly/build/git/trunk17.0/llvm-project/openmp/runtime/src/kmp.h:4037:12: note: candidate function not viable: requires 5 arguments, but 6 were provided
>  4037 | extern int __kmp_invoke_microtask(microtask_t pkfn, int gtid, int npr, int argc,
>       |            ^                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  4038 |                                   void *argv[]
>       |                                   ~~~~~~~~~~~~
> 2 errors generated.
> ```
> 
> Can be fixed by replacing the added #ifdef OMPT_SUPPORT with #if OMPT_SUPPORT:
> 
> ```
> [r5 /work1/omp-nightly/build/git/trunk17.0/llvm-project]$ git diff
> diff --git a/openmp/runtime/src/kmp_csupport.cpp b/openmp/runtime/src/kmp_csupport.cpp
> index fb79adb93641..9eeaeb88fb9e 100644
> --- a/openmp/runtime/src/kmp_csupport.cpp
> +++ b/openmp/runtime/src/kmp_csupport.cpp
> @@ -351,7 +351,7 @@ void __kmpc_fork_call_if(ident_t *loc, kmp_int32 argc, kmpc_micro microtask,
>    } else {
>      __kmpc_serialized_parallel(loc, gtid);
> 
> -#ifdef OMPT_SUPPORT
> +#if OMPT_SUPPORT
>      void *exit_frame_ptr;
>  #endif
> 
> @@ -359,7 +359,7 @@ void __kmpc_fork_call_if(ident_t *loc, kmp_int32 argc, kmpc_micro microtask,
>        __kmp_invoke_microtask(VOLATILE_CAST(microtask_t) microtask, gtid,
>                               /*npr=*/0,
>                               /*argc=*/1, &args
> -#ifdef OMPT_SUPPORT
> +#if OMPT_SUPPORT
>                               ,
>                               &exit_frame_ptr
>  #endif
> @@ -369,7 +369,7 @@ void __kmpc_fork_call_if(ident_t *loc, kmp_int32 argc, kmpc_micro microtask,
>                               /*npr=*/0,
>                               /*argc=*/0,
>                               /*args=*/nullptr
> -#ifdef OMPT_SUPPORT
> +#if OMPT_SUPPORT
>                               ,
>                               &exit_frame_ptr
>  #endif
> ```

Yeah, thanks for that. Fixed.

https://github.com/llvm/llvm-project/pull/65436


More information about the Openmp-commits mailing list