* Re: scratch/igc 3f46110b878: Fix an eassert
[not found] ` <20241211145532.114DD65A960@vcs3.savannah.gnu.org>
@ 2024-12-11 15:09 ` Pip Cet via Emacs development discussions.
2024-12-11 15:36 ` Gerd Möllmann
0 siblings, 1 reply; 4+ messages in thread
From: Pip Cet via Emacs development discussions. @ 2024-12-11 15:09 UTC (permalink / raw)
To: emacs-devel; +Cc: Gerd M�llmann
"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?
The intended assertion was that if the .intptr component is truncated to
mps_word_t size, no information is lost, because I saw some problems
with "negative" 32-bit addresses filling the MSB 32 bits of the
Lisp_Objects with ones (the sign extension/zero extension problem, in
other words). That would lead to the "splatted" Lisp_Object reading as
0xffffffff00000000, which caused trouble.
So on i386, the assertion could also be written as
(w->entries[i].intptr & 0xffffffff00000000) == 0
I think the "fixed" assertion is trivially true?
Pip
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: scratch/igc 3f46110b878: Fix an eassert
2024-12-11 15:09 ` scratch/igc 3f46110b878: Fix an eassert Pip Cet via Emacs development discussions.
@ 2024-12-11 15:36 ` Gerd Möllmann
2024-12-11 15:40 ` Gerd Möllmann
0 siblings, 1 reply; 4+ messages in thread
From: Gerd Möllmann @ 2024-12-11 15:36 UTC (permalink / raw)
To: Pip Cet; +Cc: emacs-devel, Gerd M�llmann
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?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: scratch/igc 3f46110b878: Fix an eassert
2024-12-11 15:36 ` Gerd Möllmann
@ 2024-12-11 15:40 ` Gerd Möllmann
2024-12-11 15:55 ` Gerd Möllmann
0 siblings, 1 reply; 4+ messages in thread
From: Gerd Möllmann @ 2024-12-11 15:40 UTC (permalink / raw)
To: Pip Cet; +Cc: emacs-devel, Gerd M�llmann
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: scratch/igc 3f46110b878: Fix an eassert
2024-12-11 15:40 ` Gerd Möllmann
@ 2024-12-11 15:55 ` Gerd Möllmann
0 siblings, 0 replies; 4+ messages in thread
From: Gerd Möllmann @ 2024-12-11 15:55 UTC (permalink / raw)
To: Pip Cet; +Cc: emacs-devel, Gerd M�llmann
Gerd Möllmann <gerd.moellmann@gmail.com> writes:
> 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
Please ignore, this was already fixed, I didn't see it.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-12-11 15:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <173392893159.259533.15506246926795870751@vcs3.savannah.gnu.org>
[not found] ` <20241211145532.114DD65A960@vcs3.savannah.gnu.org>
2024-12-11 15:09 ` scratch/igc 3f46110b878: Fix an eassert Pip Cet via Emacs development discussions.
2024-12-11 15:36 ` Gerd Möllmann
2024-12-11 15:40 ` Gerd Möllmann
2024-12-11 15:55 ` Gerd Möllmann
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).