]> 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>
Thu, 31 Jul 2025 12:12:50 +0000 (14:12 +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.

gcc/tree-ssa-sccvn.cc

index 45fb79cd8a1f27cdcbe0ceebc445f59dfb7c2147..a3117dacb969740b34d43d314c469afea37a1e77 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: