LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File aliasing.diff of Package gcc33 (Project openSUSE:Factory)

Index: gcc/emit-rtl.c
===================================================================
--- gcc/emit-rtl.c.orig	2009-11-20 13:04:56.000000000 +0100
+++ gcc/emit-rtl.c	2009-11-20 13:05:52.000000000 +0100
@@ -1875,6 +1875,22 @@ component_ref_for_mem_expr (ref)
 		  TREE_OPERAND (ref, 1));
 }
 
+static int indirect_ref_nonzero_ofs_p PARAMS ((tree));
+static int
+indirect_ref_nonzero_ofs_p (t)
+     tree t;
+{
+  tree op0, op1;
+  t = TREE_OPERAND (t, 0);
+  if (TREE_CODE (t) != PLUS_EXPR)
+    return 0;
+  op0 = TREE_OPERAND (t, 0);
+  op1 = TREE_OPERAND (t, 1);
+  if (TREE_CODE (op1) == INTEGER_CST && (1 || !integer_zerop (op1)))
+    return 1;
+  return 0;
+}
+
 /* Given REF, a MEM, and T, either the type of X or the expression
    corresponding to REF, set the memory attributes.  OBJECTP is nonzero
    if we are making a new object of this type.  BITPOS is nonzero if
@@ -2106,6 +2122,11 @@ set_mem_attributes_minus_bitpos (ref, t,
 	   || TREE_CODE (t) == ARRAY_RANGE_REF
 	   || TREE_CODE (t) == BIT_FIELD_REF)
     MEM_IN_STRUCT_P (ref) = 1;
+  /* An INDIRECT_REF of an PLUS expression of something with a
+     non-zero offset also is part of an aggregate.  */
+  else if (TREE_CODE (t) == INDIRECT_REF
+	   && indirect_ref_nonzero_ofs_p (t))
+    MEM_IN_STRUCT_P (ref) = 1;
 }
 
 void