From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by sourceware.org (Postfix) with ESMTPS id D79253858423 for ; Wed, 25 Aug 2021 23:08:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D79253858423 Received: by mail-pg1-x52e.google.com with SMTP id q68so1204057pga.9 for ; Wed, 25 Aug 2021 16:08:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=YTexGPzwtnH+Uo8TBxzH05VQ2ULrxMcn7dXYGd8b1ps=; b=lFQWepVuVXBizxhLRiz0UgalJgYnLr55h3cp7gdP1Z+VgsJHz7XffOq3pQcmlO0FOv IGuM8/h0Q9TuYtpi4K1OPj0FgCVzXokG6QZcppq4e6sn46IMXnTAiwd34INBi2xe4JeD nPSeiXCQ/MDnQ7Cuhammhfs1TW4xS4yg4QIMJxICVEht+t42a5ZlUEaUeOWJVHFkpUBw 8p1wVuR9SutjqWEgeV3bLuTqIRIzt75ueGHES2Rh81UbM7zhovlqhJdPInKQjXq/Lt32 q1ih4XYzDgQlgPnaFM6Nsk0Y3AeA1fcZzDVGho9ekvJDFxMSsTzSeCrY+YaOISEONvzq ywSA== X-Gm-Message-State: AOAM5303iBvqUrl84XMeHcDoZjsb3jFno71qMfbrbVxmuFX4f6omd9JX xmKh940ToOeBZgjxEN1QEi/VHzmR5aj0CQ== X-Google-Smtp-Source: ABdhPJylgx0gKMVBBEV34tmWB1BmcnUDj+yqedO4c28SStU/Clngs85Lp5vMilG13T1wwncksdRtGQ== X-Received: by 2002:a65:6658:: with SMTP id z24mr553254pgv.266.1629932917867; Wed, 25 Aug 2021 16:08:37 -0700 (PDT) Received: from [172.31.0.175] (c-98-202-48-222.hsd1.ut.comcast.net. [98.202.48.222]) by smtp.gmail.com with ESMTPSA id d20sm691828pfu.36.2021.08.25.16.08.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Aug 2021 16:08:37 -0700 (PDT) Subject: Re: [PATCH] analyzer: Recognize __builtin_free as a matching deallocator To: Siddhesh Poyarekar , Matthias Klose , David Malcolm , gcc-patches@gcc.gnu.org References: <20210728050444.3843432-1-siddhesh@gotplt.org> <511c08dcc611cc7e9ca05b101e7e11bc8c28e1e4.camel@redhat.com> <4604bd1a-8e4f-7fb3-03d4-6c9e0624c5a2@gotplt.org> From: Jeff Law Message-ID: Date: Wed, 25 Aug 2021 17:08:36 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <4604bd1a-8e4f-7fb3-03d4-6c9e0624c5a2@gotplt.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 23:08:49 -0000 On 8/25/2021 9:16 AM, Siddhesh Poyarekar wrote: > On 8/25/21 5:44 PM, Matthias Klose wrote: >> 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? >> > > Sure, it looks like only gcc11 needs this since malloc attribute > matching seems recent.  David, I've never done a backport before, may > I just cherry-pick, push and post a [committed] patch on list or does > it need to go through review? In general it's fine to cherry-pick fixes from the mainline to a release branch that fix regressions, incorrect code and the like. This doesn't fall into one of those categories -- but given this is limited to the analyzer, I think it's fine to cherry-pick into the release branch as long as David is OK with it as well. jeff