From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D70463858D33; Fri, 31 Mar 2023 18:34:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D70463858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680287687; bh=y2cWQ+xZ+NSTTliHvqHvxsNLLvcg3NUa8dS8F0P0XxA=; h=From:To:Subject:Date:From; b=CF1e8F2Yve/esNJ7uxDVS4j9rGG5EZwI96+C8vioqkxgCnjWV3j4RY6BzHD3x4JPM xQPlH4Ase5EWUYHsbJxF3H56oHprQLDzHPCEbO25FB/9fApvcM5zewYtZskoAAzUIA MV0Z3Eid2Sjtmjq4gWTnE60hMjXsayfENLhJOeYE= From: "contact at thunderperfectwitchcraft dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: contact at thunderperfectwitchcraft dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_file_loc bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109364 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 pre= vent people from letting out the return statement. But here https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D43943 it is stated that it should be only a warning since it can work if the retu= rn 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 shou= ld be a error by default, everything else is only frustrating.=