From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 95DEF385840A; Thu, 29 Sep 2022 08:24:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 95DEF385840A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664439843; bh=Gsn7nPos26aCfr/YjVgG2oji79Dr0JbOucBXS3m4KQQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=o05LYB7JRASdIMni0cBHJ6AyyjXS1+fN/UMu8qNHZ6Ucy2f/OtNCAe/aBdPXwmUcJ QpWD7ZuN6vxcQw3vQiGu2NK2FecP9ITjyS8uAPHyIU3ArNWk9MIalxi8aPRHZCG1Vn rgZG7NdD5EKaXC+vlbz6Vjrkx8ypboV3mYcLDPz0= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/105646] g++ does not raise "xxx may be used uninitialized" warning on dead code when optimizing Date: Thu, 29 Sep 2022 08:24:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth 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=3D105646 --- Comment #3 from CVS Commits --- The master branch has been updated by Richard Biener : https://gcc.gnu.org/g:a1cd4d52d6ef90b977fb2d80c1cf17f3efa5b01d commit r13-2926-ga1cd4d52d6ef90b977fb2d80c1cf17f3efa5b01d Author: Richard Biener Date: Fri Aug 19 15:11:14 2022 +0200 tree-optimization/105646 - re-interpret always executed in uninit diag The following fixes PR105646, not diagnosing int f1(); int f3(){ auto const & a =3D f1(); bool v3{v3}; return a; } with optimization because the early uninit diagnostic pass only diagnoses always executed cases. The patch does this by re-interpreting what always executed means and choosing to ignore exceptional and abnormal control flow for this. At the same time it improves things as suggested in a comment - when the value-numbering run done without optimizing figures there's a fallthru path, consider blocks on it as always executed. PR tree-optimization/105646 * tree-ssa-uninit.cc (warn_uninitialized_vars): Pre-compute the set of fallthru reachable blocks from function entry and use that to determine wlims.always_executed. * g++.dg/uninit-pr105646.C: New testcase.=