This is the mail archive of the gcc-bugs@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]

[Bug c++/17544] [4.0 Regression] incorrect -Wunreachable-code warning for reachable code following a do statement


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-10-09 22:59 -------
This is another example of why it is a mistake to use the optimizers to issue
warnings about unreachable code, uninitialized variables, etc.  

There is no easy fix for the general case.  The front end cannot avoid emitting
the return statement in all cases in which the back end might determine it is
unnecessary.  We do not have an equivalent of DECL_ARTIFICIAL for statements or
expressions so there is no good way to flag the compiler-generated return for
the middle end.

The short-term fix is probably to special-case the situation where the last
statement in main is a return, either in the middle end or in the front end. 
The longer-term fix is to move this warning out of the back end.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17544


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