This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR c/10175: Fix for -Wunreachable-code
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Roger Sayle <roger at www dot eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Steven Bosscher <S dot Bosscher at student dot tudelft dot nl>
- Date: 31 Mar 2003 11:19:17 -0800
- Subject: Re: [PATCH] PR c/10175: Fix for -Wunreachable-code
- References: <Pine.LNX.4.44.0303301324480.30306-100000@www.eyesopen.com>
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