[Bug rtl-optimization/78588] New: rtlanal.c:5210:38: runtime error: shift exponent 4294967295 is too large for 64-bit type 'long unsigned int'

trippels at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 29 13:43:00 GMT 2016


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

            Bug ID: 78588
           Summary: rtlanal.c:5210:38: runtime error: shift exponent
                    4294967295 is too large for 64-bit type 'long unsigned
                    int'
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trippels at gcc dot gnu.org
  Target Milestone: ---

-fsanitize=undefined shows:

rtlanal.c:5210:38: runtime error: shift exponent 4294967295 is too large for
64-bit type 'long unsigned int'

Testing:

diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 4e4eb2e..918088a 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -5203,7 +5203,7 @@ num_sign_bit_copies1 (const_rtx x, machine_mode mode,
const_rtx known_x,
      safely compute the mask for this mode, always return BITWIDTH.  */

   bitwidth = GET_MODE_PRECISION (mode);
-  if (bitwidth > HOST_BITS_PER_WIDE_INT)
+  if (bitwidth == 0 || bitwidth > HOST_BITS_PER_WIDE_INT)
     return 1;

   nonzero = nonzero_bits (x, mode);


More information about the Gcc-bugs mailing list