From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D1F2E382D3D6; Tue, 6 Dec 2022 21:36:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D1F2E382D3D6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670362586; bh=wUax/XWWqqWQUplqUyB9AcBrTSWbbCQqYCUqmyXF4FQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BnXFPGbw8jmZ5rGttibPb87plDVS9tqaeyJ8WVm23EkjNuDQ9yoJCbTf7GyT6t1Pc ZeIt1pSG2MAVeMjpcXGDrb7z+CnBq9UFygG8oz6oaSNiB1gVp/y9WwDWeq5K8IXL4f iFDR45+u7HKcAgtzE5F3V6quZOvSlCayoPwkrXQw= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106434] [12/13 Regression] Spurious -Wnull-dereference when using std::unique_copy() since r12-5187-g1ae8edf5f73ca5c3 Date: Tue, 06 Dec 2022 21:36:24 +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: 12.1.0 X-Bugzilla-Keywords: diagnostic 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: 12.3 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=3D106434 --- Comment #11 from CVS Commits --- The master branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:4ba94abf147fe7778a7541849ce27cafee74df9b commit r13-4525-g4ba94abf147fe7778a7541849ce27cafee74df9b Author: Jonathan Wakely Date: Mon Dec 5 12:53:42 2022 +0000 libstdc++: Add hint to compiler about vector invariants [PR106434] The PR shows a bogus warning where jump threading generates code for the undefined case that the insertion point is a value-initialized iterator but _M_finish and _M_end_of_storage are unequal (so at least one must be non-null). Using __builtin_unreachable() removes the bogus warning. Also add an assertion to diagnose undefined misuses of a null iterator here, so we don't just silently optimize that undefined code to something unsafe. libstdc++-v3/ChangeLog: PR c++/106434 * include/bits/vector.tcc (insert(const_iterator, const T&)): Add assertion and optimization hint that the iterator for the insertion point must be non-null.=