<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 - float to __int128 conversions completely broken on Mingw"
href="https://bugs.llvm.org/show_bug.cgi?id=48940">48940</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>float to __int128 conversions completely broken on Mingw
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>11.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>release blocker
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>john@johnmaddock.co.uk
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Converting a float (or indeed double) to an __int128 results in a garbage
result, test case:
#include <assert.h>
#include <type_traits>
#include <cmath>
template <class T>
struct wraps
{
T val;
template <class U>
wraps(U val, typename
std::enable_if<std::is_floating_point<U>::value>::type* = 0)
: val(static_cast<T>(std::fabs(val))){}
T get()const { return val; }
};
int main()
{
float f(2);
wraps<unsigned __int128> w(f);
assert(w.get() == 2); // always fails for __int128
return 0;
}
Tested compiler was:
$ clang++ --version
clang version 11.0.0 (<a href="https://github.com/msys2/MINGW-packages">https://github.com/msys2/MINGW-packages</a>
587690290e514a13a7a61be3f9116a1d042d2e4e)
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: D:\compilers\msys64\mingw64\bin
This is a showstopper for Boost.Multiprecision on Mingw. There are no issues
on Ubuntu Linux or with XCode clang that I can see.</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>