This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Possible patch for tree-optimization/13000

Richard Henderson <> writes:

> On Thu, Jan 20, 2005 at 09:50:57PM -0500, Ian Lance Taylor wrote:
> > I hacked around this by discarding
> > break statements which are being appended to blocks which do not fall
> > through.
> Unfortunately, this will interact badly with -Wunreachable-code,
> unless you go ahead and honor that switch immediately, which is
> starting to seem pretty ugly to me.

Note that the patch does not actually change current behaviour with
respect to -Wunreachable-code.  The only thing which the code will not
add is a GOTO_EXPR created by a break or continue statement.
-Wunreachable-code does not warn about unreachable GOTO_EXPRs.  See
remove_bb() in tree-cfg.c.

I actually don't think that we ever want to warn about the break in

  switch (x)
    case 3:

It's a bit of defensive programming, and issuing a warning via
-Wunreachable-code doesn't sound right to me even if we did warn about
unreachable gotos.

So I think that arguably my proposed patch is still reasonable, at
least with respect to -Wunreachable-code.  If you like, I could
restrict it to a break statement, not a continue statement.

But I don't feel very strongly about it.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]