[Bug tree-optimization/78035] New: Inconsistency between address comparison and alias analysis

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Oct 19 08:53:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78035

            Bug ID: 78035
           Summary: Inconsistency between address comparison and alias
                    analysis
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
                CC: hubicka at gcc dot gnu.org
  Target Milestone: ---

Consider

extern int a;
extern int b;
extern int c;

int foo(int choose_a)
{
  int *p;
  if (choose_a)
    p = &a;
  else
    p = &b;
  return p != &c;
}

int bar ()
{
  return &a != &c;
}

where trunk optimizes foo to return 1 while leaving the address comparison
in bar alone.  This is because for bar we end up invoking
symtab_node::equal_address_to which considers symbol interposition while
for simplifying foo we look at alias info (points-to) which considers
a, b and c distinct objects.

Either we are being too conservative in bar or we have a possible wrong-code
issue in foo considering the very same points-to information is also used
for alias analysis (and obviously direct accesses to a and b are not considered
aliasing either).


More information about the Gcc-bugs mailing list