From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A2B553858D32; Fri, 31 Mar 2023 22:57:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A2B553858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680303459; bh=8yNCGeTGVwWklYcy+uQd7x73Opeu6hIEx2LWGPA1/ts=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KW+qbBM1q3NCJuEK+yTT4QRkDurFWhqnwKIY1S+K8zd0bffbvRLBpvg81UEk9hklS k4sDsIspRd+lrB/0kK6A/l95ZVaqsdQj9YlGyUdZQ2X892c7VYi6y0LCsHqNWvX3NG 8QzOsl3fcadPXJJ2/tRtgY1rYVrwblvqLU01LK5Q= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109364] Missing return statement in a non void function gives only a warning but produces a forced crash. Date: Fri, 31 Mar 2023 22:57:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed 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: redi at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: DUPLICATE 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: Message-ID: In-Reply-To: References: 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 --- Comment #9 from Jonathan Wakely --- This is an intentional change in GCC 13, see PR 104642. The comments in Bug 43943 describe old behaviour, things have changed. The crash is not guaranteed though. The missing return is treated as unreachable by the compiler. If the -funreachable-traps option is enabled, = then calls to that function will result in a trap (and crash). The -funreachable-traps option is enabled by default for -O0 and -Og but at hig= her optimization levels the code is not guaranteed to crash unless you explicit= ly use -funreachable-traps.=