egcs-980214, possible bug in loop.c, revealed by -W -Wall

Jeffrey A Law law@cygnus.com
Wed Feb 18 02:42:00 GMT 1998


  In message < 199802172038.PAA04370@caip.rutgers.edu >you write:
  > 	I got one of those ambiguous `else' warnings from loop.c:
  > 
  >  > loop.c: In function `rtx_equal_for_loop_p':
  >  > loop.c:1485: warning: suggest explicit braces to avoid ambiguous `else'
  > 
  > 	The code in question looks like this:
  > 
  >  >   /* If we have a register and a constant, they may sometimes be
  >  >      equal.  */
  >  >   if (GET_CODE (x) == REG && n_times_set[REGNO (x)] == -2
  >  >       && CONSTANT_P (y))
  >  >     for (m = movables; m; m = m->next)
  >  >       if (m->move_insn && m->regno == REGNO (x)
  >  >           && rtx_equal_p (m->set_src, y))
  >  >         return 1;
  >  >  
  >  >   else if (GET_CODE (y) == REG && n_times_set[REGNO (y)] == -2
  >  >            && CONSTANT_P (x))
  >  >     for (m = movables; m; m = m->next)
  >  >       if (m->move_insn && m->regno == REGNO (y)
  >  >           && rtx_equal_p (m->set_src, x))
  >  >         return 1;
  > 
  > 
  > 	It looks to me like either the indentation of the else-if is
  > wrong, or the code is in serious need of disambiguating braces.
  > 
  > 	Would someone who knows the code please verify?
I believe the code is wrong -- the indention is what the author
wanted.  So, we need some braces around those inner if (...) return 1
statements.

I've checked in a fix for this.

jeff



More information about the Gcc mailing list