From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 87B083857022; Wed, 19 Apr 2023 11:56:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 87B083857022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681905418; bh=tGX4cqVMO7D9eHzzjJm4859vztjKyn4qx0k0V3Wqrbg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rE9LMwJeRDMi0PYImmQajloJjPDEpMNV9y1wbwvlBKzql4C0tx4KvXplli4xoc7oJ XLIY+bEgDsTe8bLnZHd8gC0K3e9kj6iQC8D88COlskqgfHs1x2GNtgn/fNyAdv03bw y796marzgYi/xR5bG6uZU172ptJg6/1k4wizR4wI= From: "xry111 at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109554] Compiler generates incorrect code when the function declared with returned parameterm but no 'return' in its body Date: Wed, 19 Apr 2023 11:56:58 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: xry111 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109554 --- Comment #2 from Xi Ruoyao --- And it's clearly documented in https://gcc.gnu.org/gcc-8/changes.html: Flowing off the end of a non-void function is considered unreachable and ma= y be subject to optimization on that basis. As a result of this change, -Wreturn-type warnings are enabled by default for C++. If you insist on ignoring the -Wreturn-type warning, you are doing things wrong.=