@@ -3032,6 +3032,9 @@ operand_equal_p (const_tree arg0, const_
TYPE_SIZE (TREE_TYPE (arg1)),
flags)))
return 0;
+ /* Verify that access happens in similar types. */
+ if (!types_compatible_p (TREE_TYPE (arg0), TREE_TYPE (arg1)))
+ return 0;
/* Verify that accesses are TBAA compatible. */
if (!alias_ptr_types_compatible_p
(TREE_TYPE (TREE_OPERAND (arg0, 1)),
@@ -0,0 +1,23 @@
+/* PR tree-optimization/70127 */
+
+struct S { int f; signed int g : 2; } a[1], c = {5, 1}, d;
+short b;
+
+__attribute__((noinline, noclone)) void
+foo (int x)
+{
+ if (x != 1)
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ while (b++ <= 0)
+ {
+ struct S e = {1, 1};
+ d = e = a[0] = c;
+ }
+ foo (a[0].g);
+ return 0;
+}