From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3974A3938C20; Fri, 29 Jan 2021 11:29:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3974A3938C20 From: "boris at kolpackov dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/98753] -Wfree-nonheap-object on unreachable code with -O0 Date: Fri, 29 Jan 2021 11:29:21 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: boris at kolpackov dot net X-Bugzilla-Status: NEW X-Bugzilla-Resolution: 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: cc 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jan 2021 11:29:22 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98753 Boris Kolpackov changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |boris at kolpackov dot net --- Comment #11 from Boris Kolpackov --- I believe I am encountering a similar false positive so I will attach the t= est cases to this bug (but let me know if I should instead attach them to 54202= or create a new bug). The attached test.cxx is a cleaned-up original code while test-simplified.cxx is its further simplified version (thanks to Matthew Krupcale for coming up with both): g++ -O1 -c test.cxx=20 In member function =E2=80=98void small_allocator::deallocate(void*, std::size_t) [with T =3D f()::expr; long unsigned int N =3D 1; B =3D small_allocator_buffer]=E2=80=99, inlined from =E2=80=98std::vector<_Tp, _Alloc>::pointer std::vector<_Tp, _Alloc>::_M_allocate_and_copy(std::vector<_Tp, _Alloc>::size_type, _ForwardIterator, _ForwardIterator) [with _ForwardIterator =3D const f()::e= xpr*; _Tp =3D f()::expr; _Alloc =3D small_allocator >]=E2=80=99 at /home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.0/b= its/alloc_traits.h:341:23, inlined from =E2=80=98void std::vector<_Tp, _Alloc>::reserve(std::vecto= r<_Tp, _Alloc>::size_type) [with _Tp =3D f()::expr; _Alloc =3D small_allocator >]=E2=80=99 at /home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.0/b= its/vector.tcc:85:36, inlined from =E2=80=98void small_vector::reserve(std::size_t) [wi= th T =3D f()::expr; long unsigned int N =3D 1]=E2=80=99 at test.cxx:234:26, inlined from =E2=80=98small_vector::small_vector() [with T =3D f(= )::expr; long unsigned int N =3D 1]=E2=80=99 at test.cxx:163:15, inlined from =E2=80=98void f()=E2=80=99 at test.cxx:1472:27: test.cxx:121:27: warning: =E2=80=98void operator delete(void*)=E2=80=99 cal= led on unallocated object =E2=80=98exprs=E2=80=99 [-Wfree-nonheap-object]=