https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126641

--- Comment #8 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
I think we’re storing past what we can store in r->sig[].  Can someone try this
and see if it fails, since I can’t reproduce on either ppc64le or aarch64?

diff --git a/gcc/real.cc b/gcc/real.cc
index 29cb6a1edd2..6a76d26ad65 100644
--- a/gcc/real.cc
+++ b/gcc/real.cc
@@ -399,6 +399,7 @@ cmp_significand_0 (const REAL_VALUE_TYPE *a)
 static inline void
 set_significand_bit (REAL_VALUE_TYPE *r, unsigned int n)
 {
+  gcc_assert (n < SIGNIFICAND_BITS);
   r->sig[n / HOST_BITS_PER_LONG]
     |= (unsigned long)1 << (n % HOST_BITS_PER_LONG);
 }

Reply via email to