]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/121320 - UBSAN error in ao_ref_init_from_vn_reference
authorRichard Biener <rguenther@suse.de>
Thu, 31 Jul 2025 11:06:36 +0000 (13:06 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 1 Aug 2025 07:20:03 +0000 (09:20 +0200)
The multiplication by BITS_PER_UNIT should be done in poly_offset_int.

PR tree-optimization/121320
* tree-ssa-sccvn.cc (ao_ref_init_from_vn_reference): Convert
op->off to poly_offset_int before multiplying by
BITS_PER_UNIT.

(cherry picked from commit ff6f7d8e005ae94ffd55f1dba727e28531c3daf3)

gcc/tree-ssa-sccvn.cc

index 7f2500e5d591df13e6fbc8e81d39fc02fe34cfb4..9bf25c67dc95513c7c824e071d2228e88cfd1512 100644 (file)
@@ -1219,7 +1219,7 @@ ao_ref_init_from_vn_reference (ao_ref *ref,
                  offset = 0;
                }
              else
-               offset += pop->off * BITS_PER_UNIT;
+               offset += poly_offset_int (pop->off) * BITS_PER_UNIT;
              op0_p = NULL;
              break;
            }
@@ -1270,7 +1270,7 @@ ao_ref_init_from_vn_reference (ao_ref *ref,
          if (maybe_eq (op->off, -1))
            max_size = -1;
          else
-           offset += op->off * BITS_PER_UNIT;
+           offset += poly_offset_int (op->off) * BITS_PER_UNIT;
          break;
 
        case REALPART_EXPR: