From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: 68690@debbugs.gnu.org
Cc: eliz@gnu.org, jm@pub.pink, monnier@iro.umontreal.ca
Subject: bug#68690: Segmentation fault building with native-comp
Date: Thu, 25 Jan 2024 09:33:45 +0100 [thread overview]
Message-ID: <m2wmrxvml2.fsf@Pro.fritz.box> (raw)
In-Reply-To: <m27cjyasff.fsf@Pro.fritz.box> ("Gerd Möllmann"'s message of "Thu, 25 Jan 2024 06:33:08 +0100")
Gerd Möllmann <gerd.moellmann@gmail.com> writes:
> Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@gnu.org> writes:
>
>>> Adding Stefan, who installed that commit.
>>
>> Oops, should be fixed now,
>>
>
> I wonder if a puthash while being in a DOHASH (which is the ASAN failure
> I showed) is something we should pursue. I don't think that's something
> that's guaranteed to work in a meaningful way. WDYT?
BTW, I'm using the code below for CL packages, which have a hash table.
A bit less hideous ;-).
/* Iterator for hash tables. */
struct h_iter
{
/* Hash table being iterated over. */
const struct Lisp_Hash_Table *h;
/* Current index in key/value vector of H. */
ptrdiff_t i;
/* Key and value at I, or nil. */
Lisp_Object key, value;
};
/* Return a freshly initialized iterator for iterating over hash table
TABLE. */
static struct h_iter
h_init (Lisp_Object table)
{
struct Lisp_Hash_Table *h = check_hash_table (table);
struct h_iter it = {.h = h, .i = 0, .key = Qnil, .value = Qnil};
return it;
}
/* Value is true if iterator IT is on a valid poisition. If it is,
IT->key and IT->value are set to key and value at that
position. */
static bool
h_valid (struct h_iter *it)
{
for (; it->i < HASH_TABLE_SIZE (it->h); ++it->i)
if (!hash_unused_entry_key_p (HASH_KEY (it->h, it->i)))
{
it->key = HASH_KEY (it->h, it->i);
it->value = HASH_VALUE (it->h, it->i);
return true;
}
return false;
}
/* Advance to next element. */
static void
h_next (struct h_iter *it)
{
++it->i;
}
/* Macrology. IT is a variable name that is bound to an iterator over
hash table TABLE for the duration of the loop. */
#define FOR_EACH_KEY_VALUE(it, table) \
for (struct h_iter it = h_init (table); h_valid (&it); h_next (&it))
next prev parent reply other threads:[~2024-01-25 8:33 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-24 14:36 bug#68690: Segmentation fault building with native-comp john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-24 17:10 ` Eli Zaretskii
2024-01-24 19:52 ` Gerd Möllmann
2024-01-24 19:56 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-24 20:27 ` Eli Zaretskii
2024-01-24 23:59 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-25 10:26 ` Eli Zaretskii
2024-01-26 2:43 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-26 8:40 ` Eli Zaretskii
2024-01-26 9:26 ` Gerd Möllmann
2024-01-26 13:48 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-26 14:36 ` Eli Zaretskii
2024-01-26 15:51 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-26 14:30 ` Eli Zaretskii
2024-01-26 14:47 ` Gerd Möllmann
2024-01-26 14:55 ` Eli Zaretskii
2024-01-27 0:08 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-27 4:07 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-27 7:50 ` Eli Zaretskii
2024-01-27 14:45 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-26 10:18 ` Andreas Schwab
2024-01-26 13:49 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-26 14:50 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-25 5:33 ` Gerd Möllmann
2024-01-25 8:33 ` Gerd Möllmann [this message]
2024-01-25 15:58 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-25 18:12 ` Mattias Engdegård
2024-01-25 22:39 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-26 16:07 ` Mattias Engdegård
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=m2wmrxvml2.fsf@Pro.fritz.box \
--to=gerd.moellmann@gmail.com \
--cc=68690@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=jm@pub.pink \
--cc=monnier@iro.umontreal.ca \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.