[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: scratch/igc 3f46110b878: Fix an eassert
From: |
Gerd Möllmann |
Subject: |
Re: scratch/igc 3f46110b878: Fix an eassert |
Date: |
Wed, 11 Dec 2024 16:40:28 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Gerd Möllmann <gerd.moellmann@gmail.com> writes:
> Pip Cet <pipcet@protonmail.com> writes:
>
>> "Gerd Moellmann" <gerd@gnu.org> writes:
>>
>>> branch: scratch/igc
>>> commit 3f46110b878ef0940ad7c0a9eacd6ef441baad7d
>>> Author: Gerd Möllmann <gerd@gnu.org>
>>> Commit: Gerd Möllmann <gerd@gnu.org>
>>>
>>> Fix an eassert
>>> ---
>>> src/igc.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/igc.c b/src/igc.c
>>> index b1ef6939b5f..2ce508e055e 100644
>>> --- a/src/igc.c
>>> +++ b/src/igc.c
>>> @@ -2223,7 +2223,7 @@ fix_weak_hash_table_weak_part (mps_ss_t ss, struct
>>> Lisp_Weak_Hash_Table_Weak_Par
>>> for (ssize_t i = 0; i < limit; i++)
>>> {
>>> if (w->entries[i].intptr & 1)
>>> - eassert ((mps_word_t)w->entries[i].intptr ^ w->entries[i].intptr
>>> == 0);
>>> + eassert ((mps_word_t)w->entries[i].intptr ^ (w->entries[i].intptr
>>> == 0));
>>> bool was_nil = (w->entries[i].intptr) == 0;
>>> intptr_t off = 0;
>>> #ifdef WORDS_BIGENDIAN
>>
>> I'm guessing I'm failing a basic C knowledge test here, but can you
>> explain? Did you run into an assertion error with the old code, or a
>> compiler warning?
>
> It was a warning from clang. So the right thing would be (x ^ y) == 0?
So thi sone?
odified src/igc.c
@@ -2278,7 +2278,7 @@ fix_weak_hash_table_weak_part (mps_ss_t ss, struct
Lisp_Weak_Hash_Table_Weak_Par
for (ssize_t i = 0; i < limit; i++)
{
if (w->entries[i].intptr & 1)
- eassert ((mps_word_t)w->entries[i].intptr ^ (w->entries[i].intptr
== 0));
+ eassert (((mps_word_t)w->entries[i].intptr ^
w->entries[i].intptr) == 0);
bool was_nil = (w->entries[i].intptr) == 0;
intptr_t off = 0;
#ifdef WORDS_BIGENDIAN