[llvm-bugs] [Bug 48940] New: float to __int128 conversions completely broken on Mingw
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jan 29 03:11:26 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=48940
Bug ID: 48940
Summary: float to __int128 conversions completely broken on
Mingw
Product: clang
Version: 11.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: release blocker
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: john at johnmaddock.co.uk
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
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 (https://github.com/msys2/MINGW-packages
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.
--
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/20210129/37c33176/attachment.html>
More information about the llvm-bugs
mailing list