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

             Bug #: 54481
           Summary: missed optimization: unnecessary indirect call
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: nel...@seznam.cz


I got carried to far in Bug 54360.
Real problem was following:

struct s{
  int (*fn)(struct s*);
};
extern int foo (struct s* ) __attribute__ ((pure));
int main(){
  struct s a;
  a.fn=foo;
  int x,y;
  while(x=a.fn(&a)){
    y++;
  }
  return y;
}

where gcc unnecessary uses indirect call because foo is pure.

Reply via email to