From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 955773887006; Tue, 7 Apr 2020 22:44:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 955773887006 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1586299469; bh=8lbV83J6norU9YlSxb5iv4ofQnouKE5trDUnLNms7dY=; h=From:To:Subject:Date:From; b=N0SbiTRUU6GMfi2jZyfkZUzuoJc/pTIYSXDr8Lf4bSYRxIfnkfCuIsXwRYBj7KNlG ARXnH1eQliupZMFx3UBVdqDB4S3bzNgJmX1BFqRjXt82D4quZos/sgTX9cGLczXhhU 9WWja4zfhGXPzAN/lof/Bb7nFHB1DW0OGxwklx44= From: "dhowells at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/94527] New: RFE: Add an __attribute__ that marks a function as freeing an object Date: Tue, 07 Apr 2020 22:44:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dhowells at redhat dot com X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Tue, 07 Apr 2020 22:44:29 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94527 Bug ID: 94527 Summary: RFE: Add an __attribute__ that marks a function as freeing an object Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: dhowells at redhat dot com Target Milestone: --- Would it be possible to add a function attribute to indicate that the funct= ion is going to destroy the object a the parameter points to (ie. a free()-like function)? Perhaps something like: void free(const volatile void *ptr) __attribute__((free(1))); where the free(N) attribute indicates the parameter number[*]. [*] Note that it's possible that a free()-like function might also take additional parameters to provide context and that context won't be destroye= d. The compiler could then warn upon future access through the pointer.=