From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 585633857B98; Thu, 16 Mar 2023 16:24:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 585633857B98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678983894; bh=7WRXElSl90oA+LjvO2wprZQopD98n5haF6YvSlCSN2s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ji1bfdhSAy66uQnK2QRJw3Ld0Do3XF4z+SG/n49KS5QD28N9cexEJsZKSKeC1DiWC 8ZvAOLDPzdXgNzEDCMYT6mBTQvkQlffkWa8di+H5Beh25ZP83DoXVFaoAs5oBubW19 KM+r/UYsue20bMHnJDxpwev9T9uW9/wc3KfofiQY= From: "mpolacek at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107532] [13 Regression] -Werror=dangling-reference false positives in libcamera-0.0.1 Date: Thu, 16 Mar 2023 16:24:53 +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: 13.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: mpolacek at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: resolution bug_status 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=3D107532 Marek Polacek changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|FIXED |--- Status|RESOLVED |ASSIGNED --- Comment #26 from Marek Polacek --- (In reply to Kohei Takahashi from comment #24) > (In reply to Marek Polacek from comment #23) > > (In reply to Kohei Takahashi from comment #21) > > > (In reply to Marek Polacek from comment #18) > > > > (In reply to Barnab=C3=A1s P=C5=91cze from comment #17) > > > > > The simple test case with std::span still triggers the warning: > > > > > https://gcc.godbolt.org/z/43cKxdqr3. I feel that without deeper c= ode > > > > > analysis such a warning will generate too many false positives an= d people > > > > > will simply turn it off. > > > >=20 > > > > There really haven't been that many, except this and one with range= -based > > > > for loops. > > >=20 > > > I think it warns many usage of zip_iterator idiom such as boost.itera= tor and > > > P2321 style flat_map. Those uses tuple of references like std::tuple<= T&...> > > > by dereferencing iterator, so that any algorithms may yield this warn= ing. > >=20 > > Ah, would you please have a testcase? If that's the case and the warni= ng > > can't be taught to recognize that pattern, then I think we need to move= it > > to -Wextra. Thanks. >=20 > In my flat map implementation, https://github.com/Flast/flat_map, the > warning is shown here > https://github.com/Flast/flat_map/blob/ > f7d547fd4dbde763c07eb8d35796248c41989a66/flat_map/__flat_tree.hpp#LL435C4= 2- > L435C52 . You can reproduce it by following > ``` > flat_map$ mkdir build > flat_map$ cd build > flat_map/build$ cmake .. > flat_map/build$ make map_tie_test_17 > ``` >=20 > `_key_extractor` is defined here, > https://github.com/Flast/flat_map/blob/ > f7d547fd4dbde763c07eb8d35796248c41989a66/flat_map/flat_map.hpp#L89-L90, a= nd > the iterator dereference is here, > https://github.com/Flast/flat_map/blob/ > f7d547fd4dbde763c07eb8d35796248c41989a66/flat_map/tied_sequence.hpp#L67-L= 72. > Hence, reduced code is like https://wandbox.org/permlink/DloAyU3dQgydo7PS, > or https://wandbox.org/permlink/7fM4NDF8u1hiRMFC. Thanks for those reduced testcases. I may be able to fix the warning there= .=