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



Jakub Jelinek <jakub at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

                 CC|                            |jakub at gcc dot gnu.org



--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-05-03 
17:00:43 UTC ---

I'd say the problem comes from the

int retval = retval;

in isr_tr_complete_low, which is supposedly inlined into the function

containing err = istr_tr_complete_low (mEp);

At least replacing that with retval = 0; makes the warning go away.



Reduced testcase for -Os -Wall:

struct A { struct A *a, *b; };

struct D { struct A e; };

struct E { unsigned char f; struct { struct A e; } g; };

struct F { struct E i[32]; };

extern int fn0 (void);

extern int fn1 (struct E *, struct D *);

static inline __attribute__ ((always_inline)) int

fn2 (const struct A *x)

{

  return x->a == x;

}

static int

fn3 (struct E *x)

{

  struct D *l, *m;

  int retval = retval;

  if (fn2 (&x->g.e))

    return 0;

  for (l = (struct D *) x->g.e.a, m = (struct D *) l->e.a; &l->e != &x->g.e; l

= m, m = (struct D *) m->e.a)

    retval = fn1 (x, l);

  return retval;

}

void

fn4 (struct F *x, unsigned k)

{

  unsigned i;

  for (i = 0; i < k; i++)

    {

      struct E *y = &x->i[i];

      int err = -22;

      err = fn3 (y);

      if (y->f == 0)

        {

          if (err > 0)

            err = fn0 ();

          if (err < 0)

            fn0 ();

        }

    }

}



I believe if fn2 returns zero, then the for body will be run at least once, but

perhaps it isn't simplified as such early enough.

Reply via email to