[Bug c++/91215] Compiled program loops endlessly because of -O2 with g++ 8.3.0

sboisvert at gydle dot com gcc-bugzilla@gcc.gnu.org
Fri Jul 19 20:14:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91215

--- Comment #5 from Sebastien Boisvert <sboisvert at gydle dot com> ---
OK, thanks for the link, this is interesting.

A previous release, g++ 7.4.0, does not generate an infinite loop in the
executable. Like g++ 8.3.0, it does print the warning: no return statement in
function returning non-void [-Wreturn-type].

So, in a way, g++ 7.4.0 handled this better than g++ 8.3.0, from a software
development standpoint.

If the warning [-Wreturn-type] can generate an infinite loop in the resulting
executable, then it should be an error, because the resulting executable is
unusable.

In the end, I should use -Werror=return-type.

Thanks


More information about the Gcc-bugs mailing list