[llvm-bugs] [Bug 47655] New: openmp offload option and complex header affects type promotion

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 26 11:42:22 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47655

            Bug ID: 47655
           Summary: openmp offload option and complex header affects type
                    promotion
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: xw111luoye at gmail.com
                CC: llvm-bugs at lists.llvm.org

Since 56069b5c71ca78749aa983c1e9de6f1e4c049f4b
The reproducer

#include <cmath>
#include <complex>
#include <iostream>

int main()
{
  std::cout << "sqrt(2.0f) = " << std::sqrt(2.0) << std::endl;
  std::cout << "sqrt(2.0) = " << std::sqrt(2.0f) << std::endl;
  std::cout << "sqrt(2) = " << std::sqrt(2) << std::endl;
}

works fine with
$ clang++ minimal.cpp

but not
$ clang++ -fopenmp -fopenmp-targets=nvptx64 minimal.cpp 
clang-12: warning: Unknown CUDA version 11.0. Assuming the latest supported
version 10.1 [-Wunknown-cuda-version]
In file included from minimal.cpp:2:
In file included from
/home/packages/llvm/master-20200923/lib/clang/12.0.0/include/openmp_wrappers/complex:44:
/home/packages/llvm/master-20200923/lib/clang/12.0.0/include/openmp_wrappers/complex_cmath.h:132:10:
error: no matching function for call to 'polar'
  return polar(sqrt(abs(__x)), arg(__x) / _Tp(2));
         ^~~~~
/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/cmath:475:5: note: in
instantiation of function template specialization
'std::sqrt[device={arch(nvptx, nvptx64)}, implementation={extension(match_any,
allow_templates)}]<int>' requested here
    sqrt(_Tp __x)
    ^
minimal.cpp:9:32: note: in instantiation of function template specialization
'std::sqrt<int>' requested here
  std::cout << "sqrt(2) = " << std::sqrt(2) << std::endl;
                               ^
/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/complex:694:5: note:
candidate template ignored: deduced conflicting types for parameter '_Tp'
('double' vs. 'int')
    polar(const _Tp& __rho, const _Tp& __theta)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200926/700d3969/attachment.html>


More information about the llvm-bugs mailing list