public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* egcs-980214, possible bug in loop.c, revealed by -W -Wall
@ 1998-02-17 14:10 Kaveh R. Ghazi
  1998-02-18  2:42 ` Jeffrey A Law
  0 siblings, 1 reply; 2+ messages in thread
From: Kaveh R. Ghazi @ 1998-02-17 14:10 UTC (permalink / raw)
  To: egcs

	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?

		Thanks,
		--Kaveh
--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		ICon CMT Corp.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: egcs-980214, possible bug in loop.c, revealed by -W -Wall
  1998-02-17 14:10 egcs-980214, possible bug in loop.c, revealed by -W -Wall Kaveh R. Ghazi
@ 1998-02-18  2:42 ` Jeffrey A Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeffrey A Law @ 1998-02-18  2:42 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: egcs

  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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-02-18  2:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-17 14:10 egcs-980214, possible bug in loop.c, revealed by -W -Wall Kaveh R. Ghazi
1998-02-18  2:42 ` Jeffrey A Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).