[Bug c++/104859] [12 regression] liibg++ fails during bootstrap

2022-03-09 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104859

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #7 from Jakub Jelinek  ---
Oops, sorry, there is
  template>>
constexpr explicit
operator T() const
{
  static_assert(sizeof(T) <= sizeof(uint64_t));
  return static_cast(lo);
}
but it is explicit so an explicit cast is needed.

[Bug c++/104859] [12 regression] liibg++ fails during bootstrap

2022-03-09 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104859

--- Comment #6 from Jakub Jelinek  ---
I'm more suprised that this ever worked.
For 32-bit libstdc++, there is no unsigned __int128 support, so it uses
uint128_t.h instead, but that class doesn't have conversion operator to
unsigned.
Wonder if
  constexpr explicit
  operator unsigned() const
  { return unsigned(lo); }
shouldn't be added to the header and then spots like
const unsigned nibble = effective_mantissa >> rounded_mantissa_bits;
be replaced with
const unsigned nibble = {effective_mantissa >> rounded_mantissa_bits};

[Bug c++/104859] [12 regression] liibg++ fails during bootstrap

2022-03-09 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104859

Patrick Palka  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org
 Ever confirmed|0   |1
 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2022-03-09

--- Comment #5 from Patrick Palka  ---
I think we just need to add some explicit casts:

diff --git a/libstdc++-v3/src/c++17/floating_to_chars.cc
b/libstdc++-v3/src/c++17/floating_to_chars.cc
index 5825e661bf4..0ccf2623511 100644
--- a/libstdc++-v3/src/c++17/floating_to_chars.cc
+++ b/libstdc++-v3/src/c++17/floating_to_chars.cc
@@ -801,14 +801,14 @@ template
 char leading_hexit;
 if constexpr (has_implicit_leading_bit)
   {
-   const unsigned nibble = effective_mantissa >> rounded_mantissa_bits;
+   const unsigned nibble = unsigned(effective_mantissa >>
rounded_mantissa_bits);
__glibcxx_assert(nibble <= 2);
leading_hexit = '0' + nibble;
effective_mantissa &= ~(mantissa_t{0b11} << rounded_mantissa_bits);
   }
 else
   {
-   const unsigned nibble = effective_mantissa >>
(rounded_mantissa_bits-4);
+   const unsigned nibble = unsigned(effective_mantissa >>
(rounded_mantissa_bits-4));
__glibcxx_assert(nibble < 16);
leading_hexit = "0123456789abcdef"[nibble];
effective_mantissa &= ~(mantissa_t{0b} <<
(rounded_mantissa_bits-4));
@@ -853,7 +853,7 @@ template
while (effective_mantissa != 0)
  {
nibble_offset -= 4;
-   const unsigned nibble = effective_mantissa >> nibble_offset;
+   const unsigned nibble = unsigned(effective_mantissa >>
nibble_offset);
__glibcxx_assert(nibble < 16);
*first++ = "0123456789abcdef"[nibble];
++written_hexits;

since on targets which lack __int128, effective_mantissa can be the
integer-class uint128_t, which unlike __int128 is only _explicitly_ convertible
to the builtin integer types.   And r12-7563-ge32869a17b788b made us correctly
exclude explicit conversion operators during copy-initialization.

[Bug c++/104859] [12 regression] liibg++ fails during bootstrap

2022-03-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104859

--- Comment #4 from Andrew Pinski  ---
(In reply to seurer from comment #3)
> stage 1.  It happens on a non-bootstrap, too.

I was worried that it was causing wrong code in the front-end.
Can you attach the preprocessed source for floating_to_chars.cc ?

[Bug c++/104859] [12 regression] liibg++ fails during bootstrap

2022-03-09 Thread seurer at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104859

--- Comment #3 from seurer at gcc dot gnu.org ---
stage 1.  It happens on a non-bootstrap, too.

[Bug c++/104859] [12 regression] liibg++ fails during bootstrap

2022-03-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104859

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |12.0

--- Comment #2 from Andrew Pinski  ---
What stage is the bootstrap at while the error happens?