An example (which I got from looking a little at varasm.c):
struct a
{
  int i;
};

int f(int *);

int g(struct a *b)
{
  struct a *b1 =b;
  int t = 0;
  for(;b < b1+3;b++)
    {
      if (b==0) return 1;
      int *c = &b->i;
      if (c == 0) return 1;
      t+=f(c);
    }
  return t;
}

-------

Currently we get:
Removing basic block 9
Merging blocks 2 and 3
g (b)
{
  struct a * b.35;
  int t;
  int D.1525;

<bb 2>:
  if (b == 0B) goto <L7>; else goto <L20>;

Invalid sum of incoming frequencies 2731, should be 2048
<L20>:;
  b.35 = b;
  t = 0;
  goto <bb 5> (<L2>);

<L0>:;
  if (b.35 == 0B) goto <L7>; else goto <L2>;

<L2>:;
  D.1525 = f (&b.35->i);
  t = t + D.1525;
  b.35 = b.35 + 4B;
  if (b.35 != (struct a *) (b + 12B)) goto <L0>; else goto <L21>;

<L7>:;
  t = 1;

Invalid sum of incoming frequencies 2156, should be 2875
<L21>:;
  return t;


-- 
           Summary: final_cleanup can mess up incoming frequencies
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


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

Reply via email to