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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2025-04-16
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

I think this patch might fix it:
```
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 38f3ae7cd84..0f3a504d064 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -1007,16 +1007,16 @@ riscv_build_integer_1 (struct riscv_integer_op
codes[RISCV_MAX_INTEGER_OPS],
          /* Now iterate over the bits we want to clear until the cost is
             too high or we're done.  */
          nval = value ^ HOST_WIDE_INT_C (-1);
-         nval &= HOST_WIDE_INT_C (~0x7fffffff);
+         nval &= ~HOST_WIDE_INT_C (0x7fffffff);
          while (nval && alt_cost < cost)
            {
              HOST_WIDE_INT bit = ctz_hwi (nval);
              alt_codes[alt_cost].code = AND;
-             alt_codes[alt_cost].value = ~(1UL << bit);
+             alt_codes[alt_cost].value = ~(HOST_WIDE_INT_UC(1) << bit);
              alt_codes[alt_cost].use_uw = false;
              alt_codes[alt_cost].save_temporary = false;
              alt_cost++;
-             nval &= ~(1UL << bit);
+             nval &= ~(HOST_WIDE_INT_UC(1) << bit);
            }

          if (nval == 0 && alt_cost <= cost)
```

But that code is only on the trunk.

Reply via email to