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.

Reply via email to