]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gimple: Handle variable-sized vectors in BIT_FIELD_REF
authorTejas Belagod <tejas.belagod@arm.com>
Thu, 5 Sep 2024 09:08:38 +0000 (14:38 +0530)
committerTejas Belagod <tejas.belagod@arm.com>
Fri, 29 Nov 2024 11:31:50 +0000 (17:01 +0530)
Handle variable-sized vectors for BIT_FIELD_REF canonicalization.

gcc/ChangeLog:

* gimple-fold.cc (maybe_canonicalize_mem_ref_addr): Handle variable
sized vector types in BIT_FIELD_REF canonicalization.
* tree-cfg.cc (verify_types_in_gimple_reference): Change object-size-
checking for BIT_FIELD_REF to error offsets that are known_gt to be
outside object-size.  Out-of-range offsets can happen in the case of
indices that reference VLA SVE vector elements that may be outside the
minimum vector size range and therefore maybe_gt is not appropirate
here.

gcc/gimple-fold.cc
gcc/tree-cfg.cc

index ba2c94794de095dbc44db0eaa0c2196b8232f97e..3c72cd6c79ae689186157154763fcc1863027ca2 100644 (file)
@@ -6347,7 +6347,7 @@ maybe_canonicalize_mem_ref_addr (tree *t, bool is_debug = false)
                                         (TYPE_SIZE (TREE_TYPE (*t))));
                  widest_int ext
                    = wi::add (idx, wi::to_widest (TYPE_SIZE (TREE_TYPE (*t))));
-                 if (wi::les_p (ext, wi::to_widest (TYPE_SIZE (vtype))))
+                 if (maybe_le (ext, wi::to_poly_widest (TYPE_SIZE (vtype))))
                    {
                      *t = build3_loc (EXPR_LOCATION (*t), BIT_FIELD_REF,
                                       TREE_TYPE (*t),
index 9ac8304e6769e6f179c9e88174682b73160b8e93..87f9776c4171b5f6ea80dc64d2d883dfaaed58b6 100644 (file)
@@ -3175,7 +3175,7 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue)
              return true;
            }
          if (!AGGREGATE_TYPE_P (TREE_TYPE (op))
-             && maybe_gt (size + bitpos,
+             && known_gt (size + bitpos,
                           tree_to_poly_uint64 (TYPE_SIZE (TREE_TYPE (op)))))
            {
              error ("position plus size exceeds size of referenced object in "