This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/81508] Control reaches end of non-void function - warning not emitted when optimization is turned on
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 22 Jul 2017 19:41:04 +0000
- Subject: [Bug c++/81508] Control reaches end of non-void function - warning not emitted when optimization is turned on
- Auto-submitted: auto-generated
- References: <bug-81508-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81508
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-07-22
Known to work| |7.1.0
Ever confirmed|0 |1
Known to fail| |6.4.1
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
So the bug is that GCC 6 ignores the noreturn attribute when there's a local
variable with a nontrivial destructor that runs after the noreturn function:
struct S {
~S() { }
};
int flush_result();
class LogMessageFatal {
public:
~LogMessageFatal() __attribute__ ((noreturn));
};
int Flush() {
S lol;
switch (flush_result()) {
case 0:
LogMessageFatal();
case 1:
return 1;
}
LogMessageFatal();
}