Problem with complex math functions

Hi all,

I have been trying to use complex math functions in the openmp target
region. I am able to use basic complex arithmetic but math functions
like abs, sin do not work. I get a linker undefined error when I use
these methods. I noticed that these methods are defined in
openmp_wrappers/complex_cmath.h in the variant region in
https://github.com/llvm/llvm-project/blob/main/clang/lib/Headers/openmp_wrappers/complex#L47.
Am I missing something?

More details,
command line: clang++ test.cpp -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda
test.cpp:
#include <iostream>
#include <complex>
#include <cmath>

int main() {
  std::complex<double> x, a, b;
#pragma omp target map(tofrom: x)
  {
    x = std::exp(a * b);
  }

  std::cout << x << std::endl;
  return 0;
}

linker error: nvlink error : Undefined reference to 'cexp' in
'/tmp/test-a02307.cubin'
CUDA details:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Tue_Sep_15_19:10:02_PDT_2020
Cuda compilation tools, release 11.1, V11.1.74
Build cuda_11.1.TC455_06.29069683_0

Please let me know if more details are needed.

Thanks & Regards,
Pushpinder Singh

This is a bug, I'm looking into it.

~ Johannes

Should be fixed with https://reviews.llvm.org/D108774.
Was an issue I observed before but did not get around to fix.

Can you file a bug so we can ask to backport it into 13?

~ Johannes

It works now with the D108774. Thanks. I have filed the bug here:
https://bugs.llvm.org/show_bug.cgi?id=51639.