From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32068 invoked by alias); 2 Mar 2017 21:56:42 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 32048 invoked by uid 89); 2 Mar 2017 21:56:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS,URIBL_RED autolearn=no version=3.3.2 spammy=H*f:Sn1mZfBgJO6d, H*f:sk:uonVYTp, H*i:anPPJ, H*MI:Sn1mZfBgJO6d X-HELO: mail-qk0-f195.google.com Received: from mail-qk0-f195.google.com (HELO mail-qk0-f195.google.com) (209.85.220.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 02 Mar 2017 21:56:39 +0000 Received: by mail-qk0-f195.google.com with SMTP id s186so22692768qkb.1 for ; Thu, 02 Mar 2017 13:56:40 -0800 (PST) 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:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=tJyFlcgBQa+1yUd8R4SJcUQ+M/keS7wELP3cd7DX0nE=; b=pSDH//wShlDK75fCOQr1rU+S2qxFdp/892CeHz6GG74LCF0bvDb7O7nJ8AGrLTViTV 5K+4bQVXn0B8bN/ac9rsyq2yM6Ev/5Y1Y/TN/KUse6yGM+vke6QMEbduM18Xm3aXkrV5 haKnxY0jZ/8blAKx72cJkghplGH2/BifMC6wrEoMPJUFhwwPp+5hztlKit9eKk5VuJ5o dEM+uMJ7lAvKDN/Nvd6L0TfsYKmDzdbIiU/c54MprecIsgHqdJfRuITlC+BBHOYPMSSN sqlExdhLsfeG9oZN/pjtdJWf+nBjYeBKLTYYKQ6k0D1ERz81PWGRgPhL+wFXi/ADchkb voxQ== X-Gm-Message-State: AMke39luMv5r4bJeiar1G3uZi79TgeBYiClrQx3uIg7VfoOOXQMmhc/0IsUS0/S8GuCllQ== X-Received: by 10.55.160.139 with SMTP id j133mr18318316qke.108.1488491798802; Thu, 02 Mar 2017 13:56:38 -0800 (PST) Received: from [192.168.0.3] (75-166-126-106.hlrn.qwest.net. [75.166.126.106]) by smtp.gmail.com with ESMTPSA id r188sm6251907qkb.50.2017.03.02.13.56.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 13:56:37 -0800 (PST) Subject: Re: [PATCH] free MPFR caches in gimple-ssa-sprintf.c (PR 79699) To: Andrew Pinski References: <60d46e1a-686b-9c27-4b48-7b658f8507fa@gmail.com> <63968707-1824-0aa5-c03d-939cdb14aba5@gmail.com> Cc: Richard Biener , Joseph Myers , Gcc Patch List From: Martin Sebor Message-ID: <12ca061a-caa8-cf55-d784-e5dec4ae9453@gmail.com> Date: Thu, 02 Mar 2017 21:56:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg00137.txt.bz2 On 03/02/2017 02:40 PM, Andrew Pinski wrote: > On Thu, Mar 2, 2017 at 1:33 PM, Martin Sebor wrote: >> On 03/02/2017 01:08 AM, Richard Biener wrote: >>> >>> On Thu, Mar 2, 2017 at 2:01 AM, Joseph Myers >>> wrote: >>>> >>>> On Wed, 1 Mar 2017, Martin Sebor wrote: >>>> >>>>> Joseph, since you commented on the bug, do you have a suggestion >>>>> for a different site for it or a guard? The only other call to >>>>> the function is in the Fortran FE and it's neither guarded nor >>>>> does it appear to ever be called. >>>> >>>> >>>> I don't think a guard is needed. Arguably it should be called from an >>>> atexit handler, but since we don't have such a handler calling it from >>>> the >>>> relevant pass seems reasonable (and I'm not sure what the right way to >>>> handle such freeing of memory in the JIT context is). >>> >>> >>> IMHO we should call it from gcc::~context >> >> >> Thanks, that makes sense to me. The attached patch does that. > > Is this function call thread safe? Or rather is MPFR thread safe? > I am thinking of the case where there are two gcc::context around one > running in each thread. I am not saying this is the current behavior > but I do know there was talk about making GCC thread safe before and I > want to make sure we understand that this might cause issues in that > goal. The latest MPFR manual implies the function is thread safe if MPFR itself has been built as thread safe: http://www.mpfr.org/mpfr-current/mpfr.html#Memory-Handling-1 Similar text is in the MPFR 2.4 manual (and so is mpfr_free_cache) so it should be safe to call the function even with older versions of the library. Martin