]> git.pld-linux.org Git - packages/gcc.git/blob - gcc-pr22071.patch
- dropin snap.
[packages/gcc.git] / gcc-pr22071.patch
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
3 @@ -1940,6 +1940,25 @@
4  }
5  
6  
7 +/* Return true if an access to [ACCESSPOS, ACCESSSIZE]
8 +   overlaps with a field at [FIELDPOS, FIELDSIZE] */
9 +
10 +static bool
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)
15 +{
16 +  if (fieldpos == accesspos && fieldsize == accesssize)
17 +    return true;
18 +  if (accesspos >= fieldpos && accesspos <= (fieldpos + fieldsize))
19 +    return true;
20 +  if (accesspos < fieldpos && (accesspos + accesssize > fieldpos))
21 +    return true;
22 +  
23 +  return false;
24 +}
25 +
26  /* Given a COMPONENT_REF T, return the constraint_expr for it.  */
27  
28  static struct constraint_expr
29 @@ -2000,8 +2019,27 @@
30          we may have to do something cute here.  */
31        
32        if (result.offset < get_varinfo (result.var)->fullsize)  
33 -       result.var = first_vi_for_offset (get_varinfo (result.var), 
34 -                                         result.offset)->id;
35 +       {
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
39 +            walk to find it.  */ 
40 +         varinfo_t curr;
41 +         for (curr = get_varinfo (result.var); curr; curr = curr->next)
42 +           {
43 +             if (offset_overlaps_with_access (curr->offset, curr->size,
44 +                                              result.offset, bitsize))
45 +               {
46 +                 result.var = curr->id;
47 +                 break;
48 +
49 +               }
50 +           }
51 +         /* assert that we found *some* field there. The user couldn't be
52 +            accessing *only* padding.  */
53 +            
54 +         gcc_assert (curr);
55 +       }
56        else
57         if (dump_file && (dump_flags & TDF_DETAILS))
58           fprintf (dump_file, "Access to past the end of variable, ignoring\n");
This page took 0.032409 seconds and 3 git commands to generate.