qemu/gcc-aliasing.diff

43 lines
1.4 KiB
Diff

Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.302.2.4
diff -u -p -r1.302.2.4 emit-rtl.c
--- gcc/emit-rtl.c 1 May 2003 09:55:39 -0000 1.302.2.4
+++ gcc/emit-rtl.c 28 Jul 2003 18:30:35 -0000
@@ -1684,6 +1684,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
@@ -1911,6 +1930,11 @@ set_mem_attributes_minus_bitpos (ref, t,
else if (TREE_CODE (t) == COMPONENT_REF || TREE_CODE (t) == ARRAY_REF
|| 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;
}