From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 175213858298; Fri, 31 Mar 2023 22:37:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 175213858298 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680302271; bh=U+Ipn36/NgnDpcGU5fS/LjXpdHZpu3CVPT8jHanv/ic=; h=From:To:Subject:Date:In-Reply-To:References:From; b=M1HqKlfGh02t9VbD+la8KmyWQy7HcT8MJeMB8oAHYj+qjMEyxxU56utejMQ3UQdrf TPa3hpk+8I6u0UXOxExGH/XZ1GIzjOR7R8IM36Jpt/D1HjLYkrFKYxLj30X4I/MP5q pIetCyNj70sEprKa61e7Ex+S2wsQvWeMSHvikGfY= From: "pinskia 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:37:50 +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: pinskia 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 #6 from Andrew Pinski --- As I will mention it again falling through from a function which has a non = void return type is undefined. So gcc thinks it is unreachable. With the option = is specify in comment #2, gcc 13 will cause a trap (usually an illegal instruc= tion but could be an abort call). So there is nothing to change about gcc. Undefined code means just that if = you invoke undefined code, anything can happen.=