Hi, while working on subsetquent changes I noticed that I got worng the boundary condition while we collect refs.
We know that match1 and match2 are the same which means that we want to start disambiguating until the last ref that reach the match. For example when one is MEM_REF and other COMPONENT_REF the ref stacks can get out of sync this way. This makes the function to give up in its current form byt with followup change we get wrong code. Bootstrapped/regtested x86_64-linux, comitted. Honza * tree-ssa-alias.c (nonoverlapping_component_refs_since_match_p): Fix check for match in the ref walk. Index: tree-ssa-alias.c =================================================================== --- tree-ssa-alias.c (revision 273084) +++ tree-ssa-alias.c (working copy) @@ -1153,15 +1153,13 @@ nonoverlapping_component_refs_since_matc auto_vec<tree, 16> component_refs2; /* Create the stack of handled components for REF1. */ - while (handled_component_p (ref1)) + while (handled_component_p (ref1) && ref1 != match1) { if (TREE_CODE (ref1) == VIEW_CONVERT_EXPR || TREE_CODE (ref1) == BIT_FIELD_REF) component_refs1.truncate (0); else component_refs1.safe_push (ref1); - if (ref1 == match1) - break; ref1 = TREE_OPERAND (ref1, 0); } if (TREE_CODE (ref1) == MEM_REF && ref1 != match1) @@ -1180,15 +1178,13 @@ nonoverlapping_component_refs_since_matc } /* Create the stack of handled components for REF2. */ - while (handled_component_p (ref2)) + while (handled_component_p (ref2) && ref2 != match2) { if (TREE_CODE (ref2) == VIEW_CONVERT_EXPR || TREE_CODE (ref2) == BIT_FIELD_REF) component_refs2.truncate (0); else component_refs2.safe_push (ref2); - if (ref2 == match2) - break; ref2 = TREE_OPERAND (ref2, 0); } if (TREE_CODE (ref2) == MEM_REF && ref2 != match2)