This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] free MPFR caches in gimple-ssa-sprintf.c (PR 79699)


On 03/02/2017 02:40 PM, Andrew Pinski wrote:
On Thu, Mar 2, 2017 at 1:33 PM, Martin Sebor <msebor@gmail.com> wrote:
On 03/02/2017 01:08 AM, Richard Biener wrote:

On Thu, Mar 2, 2017 at 2:01 AM, Joseph Myers <joseph@codesourcery.com>
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]