This is the mail archive of the gcc-patches@gcc.gnu.org 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: [PATCH] PR c/10175: Fix for -Wunreachable-code


On Mon, 2003-03-31 at 11:24, Roger Sayle wrote:
> 
> Hi Mark,
> > This looks dangerous to me on several counts:
> >
> > (1) The looking-for-labels code might be slow.
> 
> This doesn't actually slow down the compiler.  Previously, we'd
> traverse the entire expression emitting RTL as we went, now we
> just traverse the same RTL looking for labels.  So all the same
> memory is touched.

Aren't we now walking types and such as well?

> You'll also notice that SCOPE_STMTs are always expanded, so constructors
> and destructors are alway emitted.  In addition to your case above, we
> also have to consider jumping into a scope.

I thought that when your code saw the GOTO_STMT you broke out of the
loop, meaning that things after that point were skipped.  I guess I read
it wrong. :-(

> I completely agree that this kind of functionality needs to be moved
> closer to the front-ends.  You only need to look at the mess in
> jump.c:never_reached_warning and emit-rtl.c:force_line_numbers that
> is trying to track line numbers for unreachable code deep in RTL.

I guess I feel that this patch is too risky for 3.3, and not the right
approach for 3.4.  I don't want us adding more cruft in here; we should
either fix it right in the front ends or using the current approach in
the existing code, or both.

> I also won't argue that we should continue to track down where it
> is that we're currently deleting dead-code without issuing a warning.
> However, if we do use middle-end dead code elimination, it also needs
> to generate warnings for the code that it suppresses.

True -- but genrtl_if_stmt doesn't do that, so we shouldn't need to do
it there.  For 3.3, the patch I'd like to see would either fix the
problem in jump, or find the place where this code is actually being
eliminated and warn there.

Thanks,

-- 
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery dot com


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