bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#49261: Segfault during loadup


From: Paul Eggert
Subject: bug#49261: Segfault during loadup
Date: Mon, 12 Jul 2021 00:16:07 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 7/11/21 8:25 AM, Eli Zaretskii wrote:

   lisp.h:251:18: warning: unsigned conversion from 'long long int' to 
'uintptr_t' {aka 'unsigned int'} changes value from '2305843009213693951' to 
'4294967295' [-Woverflow]
     251 | # define VALMASK (USE_LSB_TAG ? - (1 << GCTYPEBITS) : VAL_MAX)
        |                  ^
   alloc.c:4767:24: note: in expansion of macro 'VALMASK'
    4767 |       uintptr_t mask = VALMASK;
        |                        ^~~~~~~
I tried to fix this on master, please take a look.

Yes that GCC warning was bogus, and your pacification of GCC is valid now that we no longer tag the MSB of pointers. Still, there should be a simpler way to pacify GCC so I installed a further fix that I hope does that (see first attached patch). This fix simply uses a cast (uintptr_t) VALMASK to pacify GCC; if GCC issues a bogus warning even for that cast, we could substitute (uintptr_t) (VALMASK & UINTPTR_MAX) though this is starting to get a little ridiculous.

The version of GCC that I tried (11.1.1 20210531 (Red Hat 11.1.1-3)) don't warn about the original code, so perhaps the bogus warning that you saw is a GCC bug that's been fixed in later GCC versions. However, GCC 11.1.1 does warn about some other stuff so I installed the remaining patches to pacify it. Some of these patches fix real (albeit unlikely) bugs in Emacs. Some work around what are evidently flaws in GCC 11.1.1. Oh well.

Attachment: 0001-Pacify-gcc-Woverflow-more-nicely.patch
Description: Text Data

Attachment: 0002-Pacify-gcc-11.1.1-Wanalyzer-null-argument.patch
Description: Text Data

Attachment: 0003-Pacify-gcc-11.1.1-Wanalyzer-possible-null-dereferenc.patch
Description: Text Data

Attachment: 0004-Pacify-gcc-11.1.1-Wclobbered.patch
Description: Text Data

Attachment: 0005-Port-test-module-to-glibc-2.33.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]