<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - __builtin_fabsl in stdlib.h is not guarded but not available for nvptx (among others)"
href="https://bugs.llvm.org/show_bug.cgi?id=48923">48923</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>__builtin_fabsl in stdlib.h is not guarded but not available for nvptx (among others)
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Standards Issues
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jdoerfert@anl.gov
</td>
</tr>
<tr>
<th>CC</th>
<td>a.bataev@hotmail.com, llvm-bugs@lists.llvm.org, mariya.podchishchaeva@intel.com, mclow.lists@gmail.com, tianshilei1992@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>When we compile the OpenMP device (=GPU) runtime, or any OpenMP device code
which includes stdlib from libc++, we are presented with an error:
```
In file included from
/mnt/scratch/elwasif/llvm-git/llvm-project/openmp/libomptarget/deviceRTLs/common/src/cancel.cu:15:
In file included from
/mnt/scratch/elwasif/llvm-git/llvm-project/openmp/libomptarget/deviceRTLs/common/debug.h:31:
In file included from
/mnt/scratch/elwasif/llvm-git/llvm-project/openmp/libomptarget/deviceRTLs/common/device_environment.h:16:
In file included from
/mnt/scratch/elwasif/llvm-git/llvm-project/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h:18:
/mnt/scratch/elwasif/llvm-git/clang-fixed/bin/../include/c++/v1/stdlib.h:128:10:
error: '__builtin_fabsl' requires 128 bit size 'long double' type support, but
device 'nvptx64' does not support it
return __builtin_fabsl(__lcpp_x);
```
This was probably introduced by <a href="https://reviews.llvm.org/D74387">https://reviews.llvm.org/D74387</a> .
It is unclear to me how to handle this. One way would eb to guard the builtin
use.
FWIW, when we target nvptx from C/C++ code right away clang simply demotes
`long double` into `double` which I find highly questionable and which can
cause all sorts of havock if we talk about memory:
<a href="https://clang.godbolt.org/z/eq6dPc">https://clang.godbolt.org/z/eq6dPc</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>