[Bug c++/109554] Compiler generates incorrect code when the function declared with returned parameterm but no 'return' in its body

2023-06-27 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109554

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|INVALID |DUPLICATE

--- Comment #4 from Andrew Pinski  ---
.

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

[Bug c++/109554] Compiler generates incorrect code when the function declared with returned parameterm but no 'return' in its body

2023-04-19 Thread schwab--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109554

Andreas Schwab  changed:

   What|Removed |Added

 Resolution|WONTFIX |INVALID

[Bug c++/109554] Compiler generates incorrect code when the function declared with returned parameterm but no 'return' in its body

2023-04-19 Thread xvladsoft at yahoo dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109554

Khokholkov Vladimir  changed:

   What|Removed |Added

 Resolution|INVALID |WONTFIX

--- Comment #3 from Khokholkov Vladimir  ---
(In reply to Xi Ruoyao from comment #2)
> And it's clearly documented in https://gcc.gnu.org/gcc-8/changes.html:
> 
> Flowing off the end of a non-void function is considered unreachable and may
> be subject to optimization on that basis. As a result of this change,
> -Wreturn-type warnings are enabled by default for C++.
> 
> If you insist on ignoring the -Wreturn-type warning, you are doing things
> wrong.

I see...
Ok, thanks!
I think the issue should be closed then.
(P.S. I do not ignore that message, just accidentally found this case and
decided to investigate).

B.R.
Vladimir.

[Bug c++/109554] Compiler generates incorrect code when the function declared with returned parameterm but no 'return' in its body

2023-04-19 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109554

--- Comment #2 from Xi Ruoyao  ---
And it's clearly documented in https://gcc.gnu.org/gcc-8/changes.html:

Flowing off the end of a non-void function is considered unreachable and may be
subject to optimization on that basis. As a result of this change,
-Wreturn-type warnings are enabled by default for C++.

If you insist on ignoring the -Wreturn-type warning, you are doing things
wrong.

[Bug c/109554] Compiler generates incorrect code when the function declared with returned parameterm but no 'return' in its body

2023-04-19 Thread schwab--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109554

Andreas Schwab  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #1 from Andreas Schwab  ---
Failure to return a value in a non-void function invokes undefined behaviour. 
For C++ this is independent of whether the caller uses the return value.