public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "contact at thunderperfectwitchcraft dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/109364] New: Missing return statement in a non void function gives only a warning but produces a forced crash.
Date: Fri, 31 Mar 2023 18:34:47 +0000	[thread overview]
Message-ID: <bug-109364-4@http.gcc.gnu.org/bugzilla/> (raw)

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	other threads:[~2023-03-31 18:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-31 18:34 contact at thunderperfectwitchcraft dot org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109364-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).