We miss a computed goto to non computed got if there is code between the 
assignment and the goto:
void g();
int f(int i)
{
  void *a;
  if (i) a = &&l1;
  else a = &&l2;
  g();
  goto *a;
l1:
  return 1;
l2:
  return 2;
}

I saw this while debugging PR13024.java and why if I tried compiling it with 
javac it passed.
That function should be equivalent to the following:
void g();
int f(int i)
{
  void *a;
  g();
  if (i) a = &&l1;
  else a = &&l2;
  goto *a;
l1:
  return 1;
l2:
  return 2;
}
where we check i is not revalant here.

-- 
           Summary: Missing computed goto to normal goto optimization
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to