aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2024-09-02 10:43:20 +0200
committerAndreas Schwab <schwab@suse.de>2024-09-02 11:50:27 +0200
commit4bf758b212170dba2b5a1881950e949ec4f8a58b (patch)
tree81f24d5c14d7c4b81fa8de4a3bcb7f83e7ed3f84
parente4d3e7f9add34216f4baffd3124bcb22a82c39bf (diff)
downloadgcc-4bf758b212170dba2b5a1881950e949ec4f8a58b.zip
gcc-4bf758b212170dba2b5a1881950e949ec4f8a58b.tar.gz
gcc-4bf758b212170dba2b5a1881950e949ec4f8a58b.tar.bz2
libsupc++: Fix handling of m68k extended real in <compare>
PR libstdc++/116513 * libsupc++/compare (_S_fp_bits) [__fmt == _M68k_80bit]: Shift padding out of exponent word.
-rw-r--r--libstdc++-v3/libsupc++/compare7
1 files changed, 6 insertions, 1 deletions
diff --git a/libstdc++-v3/libsupc++/compare b/libstdc++-v3/libsupc++/compare
index 686aa6d..63ad6b5 100644
--- a/libstdc++-v3/libsupc++/compare
+++ b/libstdc++-v3/libsupc++/compare
@@ -838,7 +838,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
using enum _Fp_fmt;
#endif
constexpr auto __fmt = _S_fp_fmt<_Tp>();
- if constexpr (__fmt == _X86_80bit || __fmt == _M68k_80bit)
+ if constexpr (__fmt == _X86_80bit)
{
if constexpr (sizeof(_Tp) == 3 * sizeof(int32_t))
{
@@ -851,6 +851,11 @@ namespace std _GLIBCXX_VISIBILITY(default)
return _Int<int16_t>(__ival._M_hi, __ival._M_lo);
}
}
+ else if constexpr (__fmt == _M68k_80bit)
+ {
+ auto __ival = __builtin_bit_cast(_Int<int32_t>, __val);
+ return _Int<int16_t>(__ival._M_hi >> 16, __ival._M_lo);
+ }
else if constexpr (sizeof(_Tp) == 2 * sizeof(int64_t))
{
#if __SIZEOF_INT128__