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 Sun, 2003-03-30 at 12:40, Roger Sayle wrote:
> 
> The following patch fixes high priority PR c/10175 which is a
> regression for both 3.3 and mainline.  The patch itself is a
> variant of my recent "Middle-end dead code elimination" patch
> http://gcc.gnu.org/ml/gcc-patches/2003-03/msg02448.html
> 
> Many thanks to Steven Bosscher for bringing this GNATS PR to my
> attention.  This revision provides an additional argument to
> expand_unreachable_stmt that controls whether a warning should
> be issued for the first "unreachable" statement in the list.

This looks dangerous to me on several counts:

(1) The looking-for-labels code might be slow.

(2) If you now have a chain of statements A, B, C where (say) A is a
DECL_STMT, B is a GOTO_STMT, and C is a end-of-scope SCOPE_STMT, you'll
leave out C.  No good.

(3) You're only doing this as code is expanded; it should really be done
for all functions, including ones that aren't expanded.

In my opinion, to do this right, the code needs to be moved further into
the front end.  On the other hand, to do it the way we have it now,
whatever is causing jump not to issue the warnings it used to should be
figured out and fixed.

-- 
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]