From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8A78D3858032; Tue, 29 Nov 2022 17:14:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8A78D3858032 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669742066; bh=gITszW5zVl7KuBMFBzjcolTHP+HjcGs1O1YCsdzTlIw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DT91xTd8mNz2gov0obsFMBMnR7w0tS7wksckqO9So0XWCVhgAml1STKv8xWHHrlqH 92r9lm89XatYFhicvF/el0svsVd0b774OqacV/MDHYa8ADCRvILpxu+cR+uHDmvmch 0PkeESZWx4wzaiEpA72T83UvbKLJF70Bmd08S8Js= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/100366] [11/12/13 Regression] spurious warning - std::vector::clear followed by std::vector::insert(vec.end(), ...) with -O2 Date: Tue, 29 Nov 2022 17:14:26 +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: 11.1.0 X-Bugzilla-Keywords: diagnostic, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.4 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=3D100366 --- Comment #16 from CVS Commits --- The master branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:cca06f0d6d76b08ed4ddb7667eda93e2e9f2589e commit r13-4393-gcca06f0d6d76b08ed4ddb7667eda93e2e9f2589e Author: Jonathan Wakely Date: Tue Nov 29 15:50:06 2022 +0000 libstdc++: Avoid bogus warning in std::vector::insert [PR107852] GCC assumes that any global variable might be modified by operator new, and so in the testcase for this PR all data members get reloaded after allocating new storage. By making local copies of the _M_start and _M_finish members we avoid that, and then the compiler has enough info to remove the dead branches that trigger bogus -Warray-bounds warnings. libstdc++-v3/ChangeLog: PR libstdc++/107852 PR libstdc++/106199 PR libstdc++/100366 * include/bits/vector.tcc (vector::_M_fill_insert): Copy _M_start and _M_finish members before allocating. (vector::_M_default_append): Likewise. (vector::_M_range_insert): Likewise.=