1 --- gcc/gcc/tree-ssa-structalias.c 2005/06/30 22:18:35 2.8
2 +++ gcc/gcc/tree-ssa-structalias.c 2005/07/01 19:45:23 2.9
7 +/* Return true if an access to [ACCESSPOS, ACCESSSIZE]
8 + overlaps with a field at [FIELDPOS, FIELDSIZE] */
11 +offset_overlaps_with_access (const unsigned HOST_WIDE_INT fieldpos,
12 + const unsigned HOST_WIDE_INT fieldsize,
13 + const unsigned HOST_WIDE_INT accesspos,
14 + const unsigned HOST_WIDE_INT accesssize)
16 + if (fieldpos == accesspos && fieldsize == accesssize)
18 + if (accesspos >= fieldpos && accesspos <= (fieldpos + fieldsize))
20 + if (accesspos < fieldpos && (accesspos + accesssize > fieldpos))
26 /* Given a COMPONENT_REF T, return the constraint_expr for it. */
28 static struct constraint_expr
29 @@ -2000,8 +2019,27 @@
30 we may have to do something cute here. */
32 if (result.offset < get_varinfo (result.var)->fullsize)
33 - result.var = first_vi_for_offset (get_varinfo (result.var),
36 + /* It's also not true that the constraint will actually start at the
37 + right offset, it may start in some padding. We only care about
38 + setting the constraint to the first actual field it touches, so
41 + for (curr = get_varinfo (result.var); curr; curr = curr->next)
43 + if (offset_overlaps_with_access (curr->offset, curr->size,
44 + result.offset, bitsize))
46 + result.var = curr->id;
51 + /* assert that we found *some* field there. The user couldn't be
52 + accessing *only* padding. */
57 if (dump_file && (dump_flags & TDF_DETAILS))
58 fprintf (dump_file, "Access to past the end of variable, ignoring\n");