public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "tromey at sourceware dot org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/31532] gdb/gmp-utils.c:169: internal-error: export_bits: Assertion `word_countp == 1' failed.
Date: Fri, 22 Mar 2024 16:14:55 +0000	[thread overview]
Message-ID: <bug-31532-4717-Bv4blVC0Gg@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31532-4717@http.sourceware.org/bugzilla/>

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
This assert is a "shouldn't happen".
So, it might be a bug elsewhere in that function,
or it could be that your GMP is built in some
unusual way.

The function tries to export an MPZ value to a byte array.
It tries to be careful to ensure the value will actually
fit into the array.  This checking is expected to rule
out the case where more space is needed than what has
been provided.

The case where the result is 0 (and so word_countp==0)
is also handled explicitly by

  /* It's possible that one of the above results in zero, which has to
     be handled specially.  */
  if (exported_val->sgn () == 0)
    {
      memset (buf.data (), 0, buf.size ());
      return;
    }

Since I don't know how to reproduce this, best would be
if you could debug gdb and stop on the failure.  Then we
can see the actual value of word_countp, the other arguments,
and perhaps even the input data -- that would let us even
write a small reproducer invoking just mpz_export so we could
see if some assumption about GMP is wrong.

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

  parent reply	other threads:[~2024-03-22 16:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-22 15:30 [Bug gdb/31532] New: " dmitry.neverov at jetbrains dot com
2024-03-22 15:49 ` [Bug gdb/31532] " vries at gcc dot gnu.org
2024-03-22 16:14 ` tromey at sourceware dot org [this message]
2024-03-22 19:31 ` dmitry.neverov at jetbrains dot com
2024-03-23 15:47 ` dmitry.neverov at jetbrains dot com
2024-03-23 18:49 ` tromey at sourceware dot 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-31532-4717-Bv4blVC0Gg@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).