From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from einhorn-mail-out.in-berlin.de (einhorn.in-berlin.de [192.109.42.8]) by sourceware.org (Postfix) with ESMTPS id D80453858409 for ; Wed, 25 Aug 2021 12:14:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D80453858409 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ubuntu.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=ubuntu.com X-Envelope-From: doko@ubuntu.com Received: from authenticated.user (localhost [127.0.0.1]) by einhorn.in-berlin.de with ESMTPSA id 17PCEIak027272 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 25 Aug 2021 14:14:19 +0200 Subject: Re: [PATCH] analyzer: Recognize __builtin_free as a matching deallocator To: David Malcolm , Siddhesh Poyarekar , gcc-patches@gcc.gnu.org References: <20210728050444.3843432-1-siddhesh@gotplt.org> <511c08dcc611cc7e9ca05b101e7e11bc8c28e1e4.camel@redhat.com> From: Matthias Klose Message-ID: Date: Wed, 25 Aug 2021 14:14:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <511c08dcc611cc7e9ca05b101e7e11bc8c28e1e4.camel@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00, BODY_8BITS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Aug 2021 12:14:31 -0000 On 7/28/21 1:44 PM, David Malcolm via Gcc-patches wrote: > On Wed, 2021-07-28 at 10:34 +0530, Siddhesh Poyarekar wrote: >> Recognize __builtin_free as being equivalent to free when passed into >> __attribute__((malloc ())), similar to how it is treated when it is >> encountered as a call.  This fixes spurious warnings in glibc where >> xmalloc family of allocators as well as reallocarray, memalign, >> etc. are declared to have __builtin_free as the free function. >> >>         gcc/analyzer/ChangeLog: >>         * sm-malloc.cc >>         (malloc_state_machine::get_or_create_deallocator): Recognize >>         __builtin_free. >> >>         gcc/testsuite/ChangeLog: >>         * gcc.dg/analyzer/attr-malloc-1.c (compatible_alloc, >>         compatible_alloc2): New extern allocator declarations. >>         (test_9, test_10): New tests. > > Looks good to me, thanks > Dave > > Please could this be backported to all active branches?