// David Li

The issue is known and being worked on. File this bug report just to track the
problem.

One of the rules that can be derived from the basic rules is that if two
access's base types are the same, access offset and size can be used to
determine the overlapping relationships of the two accesses. This is currently
not handled in GCC -- most likely an implementation issue.

Example 38:

struct BUF1
{
  int b1;
  int b12;
};


int foo(int n, struct BUF1* p, struct BUF1* q)
{
    int i = 0;
    for (i = 0; i < n; i++)
    {
        p->b1 += q->b12;            // Two accesses are not aliased with strict
aliasing
    }
    return 0;
}


The loop should be transformed into:

t1 = p->b1;
t2 = q->b12;
for (...)
{
  t1 += t2;
}
p->b1= t1;


The ansi rule can also be extended to handle cases where one type is nested
within another one.

Example 39:

struct BUF1
{
  int b1;
  int b12;
};

struct BUF2
{
  int b2;
  int g;
  struct BUF1 bf1;
};


int foo(int n, struct BUF1* p, struct BUF2* q)
{
    int i = 0;
    for (i = 0; i < n; i++)
    {
        p->b1 += q->b2;
    }
    return 0;
}


-- 
           Summary: Ansi aliasing info not fully utilized by tree SSA
                    optimizations
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: xinliangli at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35358

Reply via email to