From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CEE403870914; Wed, 20 Jan 2021 05:22:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CEE403870914 From: "akim.demaille at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/98753] -Wfree-nonheap-object on Bison generated code Date: Wed, 20 Jan 2021 05:22:09 +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: 11.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: akim.demaille at gmail dot com X-Bugzilla-Status: WAITING 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: Wed, 20 Jan 2021 05:22:09 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98753 Akim Demaille changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |akim.demaille at gmail dot= com --- Comment #2 from Akim Demaille --- Hi, I can't tell if it's the same bug of not, but there have never complaints a= bout this piece of code before GCC11, so something has most likely changed recen= tly. Note also that the 'free' is under an 'if' that clearly makes the diagnost= ic wrong (I mean, there's no need to solve the halting problem here, all the information is statically available). Besides, I would like to stress something that was said in the other PR (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D54202#c6): > If you can't fix GCC so that it can prove that the free is on a non-heap = object, then please change the warning to indicate that GCC may be wrong. F= or example: >=20 > warning: free() may be called with non-heap object 'name' Thiago Macieira is right: the warning claims "there is an error", but it on= ly *suspects* that there is one. The wording is misleading and should be fixe= d. Cheers!=