This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/31545] No warning on missing return in if construct
- From: "walter at schreppers dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Apr 2007 09:55:14 -0000
- Subject: [Bug c++/31545] No warning on missing return in if construct
- References: <bug-31545-14393@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from walter at schreppers dot com 2007-04-12 10:55 -------
Created an attachment (id=13355)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13355&action=view)
Compile with any optimization (i used -O2)
A similar type of bug occured to me a lot in the past. When using if's
sometimes a warning is issued that a return statement is needed (even if it's
not the case, or rather there is a return issued in every part of the if
construct but compiler insists on writing another dummy return on the end of
function just to get rid of the warning when using -Wall). Might be related to
current problem where no warning or error is given when there really should be
because code will crash on runtime because of the missing return statement
(could be hard to find bug in a large project!).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31545