[Bug tree-optimization/93359] Miscompile (loop check omitted) in function with missing return statement

2020-01-21 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93359

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #2 from Andrew Pinski  ---
https://gcc.gnu.org/gcc-8/porting_to.html
G++ now assumes that control never reaches the end of a non-void function (i.e.
without reaching a return statement). This means that you should always pay
attention to -Wreturn-type warnings, as they indicate code that can misbehave
when optimized.

*** This bug has been marked as a duplicate of bug 86761 ***

[Bug tree-optimization/93359] Miscompile (loop check omitted) in function with missing return statement

2020-01-21 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93359

--- Comment #1 from Andrew Pinski  ---
In c++, it is undefined behavior if you fall through to the end of a function
without a return if the type is non void.