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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
So for the access [21, 21 + 6] we get the partial def [0, 31] from _18:

n.m = _18;

we shrink that down and re-offset it to

{rhs = <ssa_name 0x7ffff660a580 18>, rhs_off = 0, offset = -5, size = 8}

we then find a previous partial def for this:

2122          r = known_ranges.root ();
(gdb) p *r
$69 = {offset = -5, size = 8, m_children = {0x0, 0x0}}
(gdb) p comparison
$73 = 0

and drop it.  I think the shrinking goes wrong, it should shrink to
[16, 31], not [16, 24].

This would mean it should bisect to r10-7013-g1cdfb80a4ec7b6 and I'm testing
the following which correctly adjusts for the padding before the object
when adjusting the size of the partial def.

diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
index bfc227f7ca0..997a37a6647 100644
--- a/gcc/tree-ssa-sccvn.cc
+++ b/gcc/tree-ssa-sccvn.cc
@@ -2080,8 +2080,9 @@ vn_walk_cb_data::push_partial_def (pd_data pd,
          pd.size -= o;
          pd.offset += o;
        }
-      if (pd.size > maxsizei)
-       pd.size = maxsizei + ((pd.size - maxsizei) % BITS_PER_UNIT);
+      if (pd.size + pd.offset > offseti + maxsizei)
+       pd.size = maxsizei + ((pd.size + pd.offset - offseti - maxsizei)
+                             % BITS_PER_UNIT);
     }

   pd.offset -= offseti;

Reply via email to