diff mbox series

[committed,PR,rtl-optimization/115876] Fix one of two ubsan reported issues in new ext-dce.cc code

Message ID e1f07d9a-83c3-4a4a-9a4b-3e593f3b2891@ventanamicro.com
State New
Headers show
Series [committed,PR,rtl-optimization/115876] Fix one of two ubsan reported issues in new ext-dce.cc code | expand

Commit Message

Jeff Law July 12, 2024, 7:14 p.m. UTC
David Binderman did a bootstrap build with ubsan enabled which triggered 
a few errors in the new ext-dce.cc code.  This fixes the trivial case of 
shifting negative values.

Bootstrapped and regression tested on x86.

Pushing to the trunk.

Jeff
PR rtl-optimization/115876
	* ext-dce.cc (carry_backpropagate): Make mask and mmask unsigned.
diff mbox series

Patch

diff --git a/gcc/ext-dce.cc b/gcc/ext-dce.cc
index adc9084df57..91789d283fc 100644
--- a/gcc/ext-dce.cc
+++ b/gcc/ext-dce.cc
@@ -374,13 +374,13 @@  binop_implies_op2_fully_live (rtx_code code)
    exclusively pertain to the first operand.  */
 
 HOST_WIDE_INT
-carry_backpropagate (HOST_WIDE_INT mask, enum rtx_code code, rtx x)
+carry_backpropagate (unsigned HOST_WIDE_INT mask, enum rtx_code code, rtx x)
 {
   if (mask == 0)
     return 0;
 
   enum machine_mode mode = GET_MODE_INNER (GET_MODE (x));
-  HOST_WIDE_INT mmask = GET_MODE_MASK (mode);
+  unsigned HOST_WIDE_INT mmask = GET_MODE_MASK (mode);
   switch (code)
     {
     case PLUS: