From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6B32E388E806; Mon, 13 Jul 2020 11:26:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6B32E388E806 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594639570; bh=fCm/sAOLwGvDFUW4dUR+jv1VjnovemELOXzqZPbZ0mA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=H26iLpiCh10AQMqoe2kKW0/M7eRmj15mb2i50SP27Zk+KncRft0+ninMWOyRQYSiw wUkbKemONIuNigdsiO84J7Xt/AI6BA9+sLeu/bHPDNu+NbrHG9jzr6nr6byeHnzDGI pqbBs9mTj3gF6XHxfsrAcN/PTYK8nX15clL+oFSU= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96181] Missing return statement now leads to crashes Date: Mon, 13 Jul 2020 11:26:10 +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: 8.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jul 2020 11:26:10 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96181 --- Comment #3 from Jonathan Wakely --- (In reply to Arturo Laurenzi from comment #0) > Now, I understand the code snipped is probably broken. However, this chan= ge > breaks old code that would work just fine by ignoring the undefined return > value. It didn't work fine, it had undefined behaviour. It just appeared to work f= ine. GCC clearly warns you about it: 96181.C: In function =E2=80=98bool func(int)=E2=80=99: 96181.C:9:1: warning: no return statement in function returning non-void [-Wreturn-type] 9 | } // missing return statement | ^ If you're ignoring such warnings routinely maybe you should use -Werror=3Dreturn-type to force yourself to fix them.=