dead code identification

Robert William Fuller hydrologiccycle@gmail.com
Wed Feb 13 20:59:00 GMT 2008


Mark Hampton wrote:
> On Wednesday 13 February 2008 17:26, Matthew Woehlke wrote:
>> Mark Hampton wrote:
>>> I would like to identify dead/redundant code that is being optimized away
>>> by gcc. Is there a way to have gcc report the line number associated with
>>> this code ?
>> I guess someone should point out that some commercial compilers (Sun's
>> comes to mind) issue warnings for unreachable code. IMO this would make
>> a nice improvement to gcc.
> 
> Thanks for that - I had not thought of using "unreachable code" as the search 
> term :
> 
> -Wunreachable-code
>     Warn if the compiler detects that code will never be executed.
> 
> So it does seem gcc supports this.

The warning seems to be pretty lousy.  It reports on things that are 
clearly reachable.



More information about the Gcc-help mailing list