]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[PR rtl-optimization/115876] Fix one of two ubsan reported issues in new ext-dce...
authorJeff Law <jlaw@ventanamicro.com>
Fri, 12 Jul 2024 19:11:33 +0000 (13:11 -0600)
committerJeff Law <jlaw@ventanamicro.com>
Fri, 12 Jul 2024 19:13:23 +0000 (13:13 -0600)
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.

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

gcc/ext-dce.cc

index adc9084df57d075f62e669ac76a3dbb5c4fe3e96..91789d283fcdf7f324905ce1556ddd742c8c739b 100644 (file)
@@ -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: