public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109364] New: Missing return statement in a non void function gives only a warning but produces a forced crash.
@ 2023-03-31 18:34 contact at thunderperfectwitchcraft dot org
  2023-03-31 18:38 ` [Bug c++/109364] " pinskia at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: contact at thunderperfectwitchcraft dot org @ 2023-03-31 18:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109364
           Summary: Missing return statement in a non void function gives
                    only a warning but produces a forced crash.
           Product: gcc
           Version: 13.0
               URL: https://www.reddit.com/r/gcc/comments/123ojov/no_retur
                    n_in_function_binary_crashes_with/
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: contact at thunderperfectwitchcraft dot org
  Target Milestone: ---

Calling

int Test()
{
        std::cout << "Test";
}

from main causes the program to crash, even though only a warning is given.
As pointed out in this thread
https://www.reddit.com/r/gcc/comments/123ojov/no_return_in_function_binary_crashes_with/
this is because a invalid instruction is returned to cause the crash to prevent
people from letting out the return statement. But here
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43943
it is stated that it should be only a warning since it can work if the return
value isn't used anywhere. This is no longer the case, as there is no way to
bring this code to run as far as I can see. To reduce the confusion it should
be a error by default, everything else is only frustrating.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-03-31 23:24 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-31 18:34 [Bug c++/109364] New: Missing return statement in a non void function gives only a warning but produces a forced crash contact at thunderperfectwitchcraft dot org
2023-03-31 18:38 ` [Bug c++/109364] " pinskia at gcc dot gnu.org
2023-03-31 18:40 ` pinskia at gcc dot gnu.org
2023-03-31 22:17 ` contact at thunderperfectwitchcraft dot org
2023-03-31 22:19 ` pinskia at gcc dot gnu.org
2023-03-31 22:21 ` contact at thunderperfectwitchcraft dot org
2023-03-31 22:37 ` pinskia at gcc dot gnu.org
2023-03-31 22:46 ` contact at thunderperfectwitchcraft dot org
2023-03-31 22:54 ` pinskia at gcc dot gnu.org
2023-03-31 22:57 ` redi at gcc dot gnu.org
2023-03-31 23:00 ` contact at thunderperfectwitchcraft dot org
2023-03-31 23:24 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).