public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/27806] free(): invalid pointer during gdb.ada/fixed_cmp.exp
Date: Fri, 30 Apr 2021 14:29:11 +0000	[thread overview]
Message-ID: <bug-27806-4717-dOW4mxichk@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-27806-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=27806

--- Comment #9 from Tom de Vries <vries at gcc dot gnu.org> ---
Two relevant pieces from guile.git/NEWS:
...
** Fix important incompatibility with GnuTLS

Guile uses the GNU multi-precision (GMP) library to implement
arbitrary-precision integers (bignums) and fractions.  Usually Guile is
built to dynamically link to libgmp.  In this configuration, any other
user of GMP in the process uses the same libgmp instance, with the same
shared state.

An important piece of shared state is the GMP allocator, responsible for
allocating storage for the digits of large integers.  For Guile it's
most efficient to install libgc as the GMP allocator.  That way Guile
doesn't need to install finalizers, which have significant overhead, to
free GMP values when Guile bignums are collected.  Using libgc to
allocate digits also allows Guile's GC to adequately measure the memory
cost of these values.

However, if the Guile process is linked to some other user of GMP, then
probably the references from the other library to GMP values aren't
visible to the garbage collector.  In this case libgc could prematurely
collect values from that other GMP user.

This isn't theoretical, sadly: it happens for Guile-GnuTLS.  GnuTLS uses
GMP, and so does Guile.  Since Guile 2.0.4, Guile has installed libgc as
the GMP allocator, so since then, Guile-GnuTLS has been buggy.

Therefore, the default is now to not install libgc as the GMP allocator.
This may slow down some uses of bignums.  If you know that your Guile
program will never use a library that uses GMP, you can set the
GUILE_INSTALL_GMP_MEMORY_FUNCTIONS=1 in your environment.  Guile sets
this environment variable when building Guile, for example.  See
"Environment Variables" in the manual, for more.

In some future, Guile may switch to GMP's more low-level "MPN" API for
working with bignums, which would allow us to regain the ability to use
GC-managed digit storage in all configurations.

** New build option: --enable-mini-gmp

For some users, it would be preferable to bundle a private copy of the
GMP bignum library into Guile.  Some users would like to avoid the extra
dependency.  Others would like to use libgc to manage GMP values, while
not perturbing the GMP allocator for other GMP users.

For these cases, Guile now has an --enable-mini-gmp configure option,
which will use a stripped-down version of GMP, bundled with Guile.  This
code doesn't have all the algorithmic optimizations of full GMP, but
implements the same API in a basic way.  It can be more optimal in a
Guile context, given that it can use libgc to allocate its data.

Note that a build with --enable-mini-gmp is not ABI-compatible with a
"stock" build, as functions that use GMP types (scm_to_mpz,
scm_from_mpz) are not exported.

Thanks to Niels Möller and other GMP developers for their mini-gmp
implementation!
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2021-04-30 14:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-30 12:49 [Bug gdb/27806] New: " vries at gcc dot gnu.org
2021-04-30 12:50 ` [Bug gdb/27806] " vries at gcc dot gnu.org
2021-04-30 12:52 ` vries at gcc dot gnu.org
2021-04-30 13:19 ` vries at gcc dot gnu.org
2021-04-30 13:48 ` vries at gcc dot gnu.org
2021-04-30 14:00 ` vries at gcc dot gnu.org
2021-04-30 14:09 ` simark at simark dot ca
2021-04-30 14:13 ` vries at gcc dot gnu.org
2021-04-30 14:26 ` vries at gcc dot gnu.org
2021-04-30 14:29 ` vries at gcc dot gnu.org [this message]
2021-04-30 14:35 ` vries at gcc dot gnu.org
2021-04-30 14:37 ` simark at simark dot ca
2021-04-30 14:42 ` vries at gcc dot gnu.org
2021-04-30 14:56 ` vries at gcc dot gnu.org
2021-05-03  8:39 ` [Bug guile/27806] " vries at gcc dot gnu.org
2021-05-03  8:55 ` vries at gcc dot gnu.org
2021-05-04  8:26 ` cvs-commit at gcc dot gnu.org
2021-05-04  8:28 ` vries at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-27806-4717-dOW4mxichk@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).