From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#49261: Segfault during loadup Date: Mon, 12 Jul 2021 00:16:07 -0700 Organization: UCLA Computer Science Department Message-ID: References: <87o8bn7bie.fsf@gnus.org> <87zgv6vuon.fsf@gmx.de> <837di9lwbm.fsf@gnu.org> <87a6n5vuu4.fsf@gnus.org> <8735sqnmei.fsf@gnus.org> <87zguyf4ht.fsf@gmx.de> <87pmvum54p.fsf@gnus.org> <87v95mf2lj.fsf@gmx.de> <87pmvt3ob1.fsf@gnus.org> <83r1g9evoy.fsf@gnu.org> <83pmvtevgg.fsf@gnu.org> <87czrt3mj4.fsf@gnus.org> <878s2h3m1d.fsf@gnus.org> <874kd53lnl.fsf@gnus.org> <87zgux26ab.fsf@gnus.org> <87pmvt25uq.fsf@gnus.org> <87lf6h2294.fsf@gnus.org> <87h7h51x9y.fsf_-_@gnus.org> <83bl79b17n.fsf@gnu.org> <835yxgc1pm.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------F8EEEB1413B5AA2A495BA107" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36131"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 Cc: larsi@gnus.org, 49261@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jul 12 09:17:19 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m2qBr-0009BL-EN for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 12 Jul 2021 09:17:19 +0200 Original-Received: from localhost ([::1]:41168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m2qBq-00053Z-Ed for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 12 Jul 2021 03:17:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m2qBb-00053P-Tr for bug-gnu-emacs@gnu.org; Mon, 12 Jul 2021 03:17:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53116) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m2qBa-0002kk-F7 for bug-gnu-emacs@gnu.org; Mon, 12 Jul 2021 03:17:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m2qBa-00065Z-6u for bug-gnu-emacs@gnu.org; Mon, 12 Jul 2021 03:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Jul 2021 07:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49261 X-GNU-PR-Package: emacs Original-Received: via spool by 49261-submit@debbugs.gnu.org id=B49261.162607417823350 (code B ref 49261); Mon, 12 Jul 2021 07:17:02 +0000 Original-Received: (at 49261) by debbugs.gnu.org; 12 Jul 2021 07:16:18 +0000 Original-Received: from localhost ([127.0.0.1]:36429 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m2qAr-00064Y-P0 for submit@debbugs.gnu.org; Mon, 12 Jul 2021 03:16:18 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:43640) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m2qAp-00064H-6V for 49261@debbugs.gnu.org; Mon, 12 Jul 2021 03:16:17 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id C14B2160064; Mon, 12 Jul 2021 00:16:09 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 2n9fMW0K0avb; Mon, 12 Jul 2021 00:16:07 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B3F1B16006F; Mon, 12 Jul 2021 00:16:07 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id khvVJkWDeXf1; Mon, 12 Jul 2021 00:16:07 -0700 (PDT) Original-Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 7B95D160064; Mon, 12 Jul 2021 00:16:07 -0700 (PDT) In-Reply-To: <835yxgc1pm.fsf@gnu.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:209812 Archived-At: This is a multi-part message in MIME format. --------------F8EEEB1413B5AA2A495BA107 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable 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_M= AX) >> | ^ >> alloc.c:4767:24: note: in expansion of macro 'VALMASK' >> 4767 | uintptr_t mask =3D 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=20 now that we no longer tag the MSB of pointers. Still, there should be a=20 simpler way to pacify GCC so I installed a further fix that I hope does=20 that (see first attached patch). This fix simply uses a cast (uintptr_t)=20 VALMASK to pacify GCC; if GCC issues a bogus warning even for that cast,=20 we could substitute (uintptr_t) (VALMASK & UINTPTR_MAX) though this is=20 starting to get a little ridiculous. The version of GCC that I tried (11.1.1 20210531 (Red Hat 11.1.1-3))=20 don't warn about the original code, so perhaps the bogus warning that=20 you saw is a GCC bug that's been fixed in later GCC versions. However,=20 GCC 11.1.1 does warn about some other stuff so I installed the remaining=20 patches to pacify it. Some of these patches fix real (albeit unlikely)=20 bugs in Emacs. Some work around what are evidently flaws in GCC 11.1.1.=20 Oh well. --------------F8EEEB1413B5AA2A495BA107 Content-Type: text/x-patch; charset=UTF-8; name="0001-Pacify-gcc-Woverflow-more-nicely.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-Pacify-gcc-Woverflow-more-nicely.patch" =46rom da2f772fe575b20bff51b49aa5ded2bf15a2c89d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 11 Jul 2021 23:54:32 -0700 Subject: [PATCH 1/5] Pacify gcc -Woverflow more nicely * src/alloc.c (mark_maybe_pointer): Simplify pacification of gcc -Woverflow (unknown GCC version). --- src/alloc.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index e3b038c51c..ee3fd64a00 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4764,12 +4764,7 @@ mark_maybe_pointer (void *p, bool symbol_only) from Emacs source code, it can occur in some cases. To fix this problem, the pdumper code should grok non-initial addresses, as the non-pdumper code does. */ -#ifdef WIDE_EMACS_INT - uintptr_t mask =3D ~((uintptr_t) 0); -#else - uintptr_t mask =3D VALMASK; -#endif - void *po =3D (void *) ((uintptr_t) p & mask); + void *po =3D (void *) ((uintptr_t) p & (uintptr_t) VALMASK); char *cp =3D p; char *cpo =3D po; /* Don't use pdumper_object_p_precise here! It doesn't check the --=20 2.30.2 --------------F8EEEB1413B5AA2A495BA107 Content-Type: text/x-patch; charset=UTF-8; name="0002-Pacify-gcc-11.1.1-Wanalyzer-null-argument.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0002-Pacify-gcc-11.1.1-Wanalyzer-null-argument.patch" =46rom 2337869fbf8b967eb53ee57f978f3751987e43dc Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 12 Jul 2021 00:00:20 -0700 Subject: [PATCH 2/5] Pacify gcc 11.1.1 -Wanalyzer-null-argument MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * lib-src/etags.c (regexp): Omit member force_explicit_name, since it=E2=80=99s always true. All uses removed. This lets us remove calls to strlen (name) where GCC isn=E2=80=99t smart enough to deduce that name must be nonnull. * lib-src/movemail.c (main): Fix bug that could cause link (tempname, NULL) to be called. * src/emacs.c (argmatch): Break check into two =E2=80=98if=E2=80=99s, since GCC doesn=E2=80=99t seem to be smart enough to check the single =E2= =80=98if=E2=80=99. * src/gtkutil.c (xg_update_menu_item): Fix bug where strcmp could be given a NULL arg. * src/xfont.c (xfont_list_family): Use nonnull value for dummy initial value. --- lib-src/etags.c | 49 ++++++++++++++++++---------------------------- lib-src/movemail.c | 14 +++++-------- src/emacs.c | 4 +++- src/gtkutil.c | 2 +- src/xfont.c | 5 ++++- 5 files changed, 32 insertions(+), 42 deletions(-) diff --git a/lib-src/etags.c b/lib-src/etags.c index c39c93db33..88b49f803e 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -340,7 +340,6 @@ #define xrnew(op, n, m) ((op) =3D xnrealloc (op, n, (= m) * sizeof *(op))) struct re_pattern_buffer *pat; /* the compiled pattern */ struct re_registers regs; /* re registers */ bool error_signaled; /* already signaled for this regexp */ - bool force_explicit_name; /* do not allow implicit tag name */ bool ignore_case; /* ignore case when matching */ bool multi_line; /* do a multi-line match on the whole file */ } regexp; @@ -6910,7 +6909,6 @@ add_regex (char *regexp_pattern, language *lang) struct re_pattern_buffer *patbuf; regexp *rp; bool - force_explicit_name =3D true, /* do not use implicit tag names */ ignore_case =3D false, /* case is significant */ multi_line =3D false, /* matches are done one line at a time */ single_line =3D false; /* dot does not match newline */ @@ -6949,7 +6947,8 @@ add_regex (char *regexp_pattern, language *lang) case 'N': if (modifiers =3D=3D name) error ("forcing explicit tag name but no name, ignoring"); - force_explicit_name =3D true; + /* This option has no effect and is present only for backward + compatibility. */ break; case 'i': ignore_case =3D true; @@ -7004,7 +7003,6 @@ add_regex (char *regexp_pattern, language *lang) p_head->pat =3D patbuf; p_head->name =3D savestr (name); p_head->error_signaled =3D false; - p_head->force_explicit_name =3D force_explicit_name; p_head->ignore_case =3D ignore_case; p_head->multi_line =3D multi_line; } @@ -7144,20 +7142,15 @@ regex_tag_multiline (void) name =3D NULL; else /* make a named tag */ name =3D substitute (buffer, rp->name, &rp->regs); - if (rp->force_explicit_name) - { - /* Force explicit tag name, if a name is there. */ - pfnote (name, true, buffer + linecharno, - charno - linecharno + 1, lineno, linecharno); - - if (debug) - fprintf (stderr, "%s on %s:%"PRIdMAX": %s\n", - name ? name : "(unnamed)", curfdp->taggedfname, - lineno, buffer + linecharno); - } - else - make_tag (name, strlen (name), true, buffer + linecharno, - charno - linecharno + 1, lineno, linecharno); + + /* Force explicit tag name, if a name is there. */ + pfnote (name, true, buffer + linecharno, + charno - linecharno + 1, lineno, linecharno); + + if (debug) + fprintf (stderr, "%s on %s:%"PRIdMAX": %s\n", + name ? name : "(unnamed)", curfdp->taggedfname, + lineno, buffer + linecharno); break; } } @@ -7471,18 +7464,14 @@ readline (linebuffer *lbp, FILE *stream) name =3D NULL; else /* make a named tag */ name =3D substitute (lbp->buffer, rp->name, &rp->regs); - if (rp->force_explicit_name) - { - /* Force explicit tag name, if a name is there. */ - pfnote (name, true, lbp->buffer, match, lineno, linecharno); - if (debug) - fprintf (stderr, "%s on %s:%"PRIdMAX": %s\n", - name ? name : "(unnamed)", curfdp->taggedfname, - lineno, lbp->buffer); - } - else - make_tag (name, strlen (name), true, - lbp->buffer, match, lineno, linecharno); + + /* Force explicit tag name, if a name is there. */ + pfnote (name, true, lbp->buffer, match, lineno, linecharno); + + if (debug) + fprintf (stderr, "%s on %s:%"PRIdMAX": %s\n", + name ? name : "(unnamed)", curfdp->taggedfname, + lineno, lbp->buffer); break; } } diff --git a/lib-src/movemail.c b/lib-src/movemail.c index cfdebccb8d..e683da179d 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c @@ -270,6 +270,7 @@ main (int argc, char **argv) You might also wish to verify that your system is one which uses lock files for this purpose. Some systems use other methods. */= =20 + bool lockname_unlinked =3D false; inname_len =3D strlen (inname); lockname =3D xmalloc (inname_len + sizeof ".lock"); strcpy (lockname, inname); @@ -312,15 +313,10 @@ main (int argc, char **argv) Five minutes should be good enough to cope with crashes and wedgitude, and long enough to avoid being fooled by time differences between machines. */ - if (stat (lockname, &st) >=3D 0) - { - time_t now =3D time (0); - if (st.st_ctime < now - 300) - { - unlink (lockname); - lockname =3D 0; - } - } + if (!lockname_unlinked + && stat (lockname, &st) =3D=3D 0 + && st.st_ctime < time (0) - 300) + lockname_unlinked =3D unlink (lockname) =3D=3D 0 || errno =3D=3D EN= OENT; } =20 delete_lockname =3D lockname; diff --git a/src/emacs.c b/src/emacs.c index b7982ece64..866e43fda9 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -670,7 +670,9 @@ argmatch (char **argv, int argc, const char *sstr, co= nst char *lstr, } arglen =3D (valptr !=3D NULL && (p =3D strchr (arg, '=3D')) !=3D NULL ? p - arg : strlen (arg)); - if (lstr =3D=3D 0 || arglen < minlen || strncmp (arg, lstr, arglen) !=3D= 0) + if (!lstr) + return 0; + if (arglen < minlen || strncmp (arg, lstr, arglen) !=3D 0) return 0; else if (valptr =3D=3D NULL) { diff --git a/src/gtkutil.c b/src/gtkutil.c index dee2a93089..313cfc82c2 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -3221,7 +3221,7 @@ xg_update_menu_item (widget_value *val, gtk_label_set_text (wkey, utf8_key); } =20 - if (! old_label || strcmp (utf8_label, old_label) !=3D 0) + if (utf8_label && (! old_label || strcmp (utf8_label, old_label) !=3D = 0)) { label_changed =3D true; gtk_label_set_text (wlbl, utf8_label); diff --git a/src/xfont.c b/src/xfont.c index 0570ee96a9..81d356175a 100644 --- a/src/xfont.c +++ b/src/xfont.c @@ -596,7 +596,10 @@ xfont_list_family (struct frame *f) char **names; int num_fonts, i; Lisp_Object list; - char *last_family UNINIT; + char const *last_family; +#if defined GCC_LINT || defined lint + last_family =3D ""; +#endif int last_len; =20 block_input (); --=20 2.30.2 --------------F8EEEB1413B5AA2A495BA107 Content-Type: text/x-patch; charset=UTF-8; name="0003-Pacify-gcc-11.1.1-Wanalyzer-possible-null-dereferenc.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="0003-Pacify-gcc-11.1.1-Wanalyzer-possible-null-dereferenc.pa"; filename*1="tch" =46rom 1a0fe2a5184cd4c57972994cf4b688042aecc534 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 12 Jul 2021 00:06:34 -0700 Subject: [PATCH 3/5] Pacify gcc 11.1.1 -Wanalyzer-possible-null-dereferen= ce MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * oldXMenu/Create.c (XMenuCreate): * oldXMenu/Internal.c (_XMRecomputePane, _XMRecomputeSelection): * oldXMenu/XMakeAssoc.c (XMakeAssoc): * test/src/emacs-module-resources/mod-test.c (Fmod_test_userptr_make): Don=E2=80=99t assume that malloc and calloc succeed. --- oldXMenu/Create.c | 2 ++ oldXMenu/Internal.c | 31 +++++++++------------- oldXMenu/XMakeAssoc.c | 2 ++ test/src/emacs-module-resources/mod-test.c | 4 +++ 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/oldXMenu/Create.c b/oldXMenu/Create.c index 7eb17c508d..e209bbecee 100644 --- a/oldXMenu/Create.c +++ b/oldXMenu/Create.c @@ -598,6 +598,8 @@ XMenuCreate(Display *display, Window parent, register= char const *def_env) * Create pane, active, and inactive GC's. */ values =3D (XGCValues *)malloc(sizeof(XGCValues)); + if (!values) + return NULL; valuemask =3D (GCForeground | GCBackground | GCFont | GCLineWidth); =20 /* diff --git a/oldXMenu/Internal.c b/oldXMenu/Internal.c index f489e27bea..3e97f9ab3f 100644 --- a/oldXMenu/Internal.c +++ b/oldXMenu/Internal.c @@ -534,7 +534,6 @@ _XMRecomputePane(register Display *display, register = XMenu *menu, register XMPan register int window_y; /* Recomputed window Y coordinate. */ =20 unsigned long change_mask; /* Value mask to reconfigure window. */ - XWindowChanges *changes; /* Values to use in configure window. */ =20 register Bool config_p =3D False; /* Reconfigure pane window? */ =20 @@ -612,21 +611,19 @@ _XMRecomputePane(register Display *display, registe= r XMenu *menu, register XMPan * it for creation with the new configuration. */ if (p_ptr->window) { + XWindowChanges changes; change_mask =3D (CWX | CWY | CWWidth | CWHeight); - changes =3D (XWindowChanges *)malloc(sizeof(XWindowChanges)); - changes->x =3D p_ptr->window_x; - changes->y =3D p_ptr->window_y; - changes->width =3D p_ptr->window_w; - changes->height =3D p_ptr->window_h; + changes.x =3D p_ptr->window_x; + changes.y =3D p_ptr->window_y; + changes.width =3D p_ptr->window_w; + changes.height =3D p_ptr->window_h; =20 XConfigureWindow( display, p_ptr->window, change_mask, - changes + &changes ); - free(changes); - } else { if (_XMWinQueAddPane(display, menu, p_ptr) =3D=3D _FAILURE) { @@ -681,7 +678,6 @@ _XMRecomputeSelection(register Display *display, regi= ster XMenu *menu, register /* Selection sequence number. */ { register Bool config_s =3D False; /* Reconfigure selection window? *= / - XWindowChanges *changes; /* Values to change in configure. */ unsigned long change_mask; /* Value mask for XConfigureWindow. */ =20 /* @@ -738,22 +734,19 @@ _XMRecomputeSelection(register Display *display, re= gister XMenu *menu, register * for creation with the new configuration. */ if (s_ptr->window) { - changes =3D (XWindowChanges *)malloc(sizeof(XWindowChanges)); + XWindowChanges changes; change_mask =3D (CWX | CWY | CWWidth | CWHeight); - changes =3D (XWindowChanges *)malloc(sizeof(XWindowChanges)); - changes->x =3D s_ptr->window_x; - changes->y =3D s_ptr->window_y; - changes->width =3D s_ptr->window_w; - changes->height =3D s_ptr->window_h; + changes.x =3D s_ptr->window_x; + changes.y =3D s_ptr->window_y; + changes.width =3D s_ptr->window_w; + changes.height =3D s_ptr->window_h; =20 XConfigureWindow( display, s_ptr->window, change_mask, - changes + &changes ); - free(changes); - } else { if (_XMWinQueAddSelection(display, menu, s_ptr) =3D=3D _FAILURE) { diff --git a/oldXMenu/XMakeAssoc.c b/oldXMenu/XMakeAssoc.c index 9bbde2cf94..2530e8e507 100644 --- a/oldXMenu/XMakeAssoc.c +++ b/oldXMenu/XMakeAssoc.c @@ -69,6 +69,8 @@ XMakeAssoc(register Display *dpy, register XAssocTable = *table, register XID x_id /* before the current value of "Entry". */ /* Create a new XAssoc and load it with new provided data. */ new_entry =3D (XAssoc *) malloc(sizeof(XAssoc)); + if (!new_entry) + return; /* This obsolete API has no way to report failure! */ new_entry->display =3D dpy; new_entry->x_id =3D x_id; new_entry->data =3D data; diff --git a/test/src/emacs-module-resources/mod-test.c b/test/src/emacs-= module-resources/mod-test.c index ad59cfc18c..5720af8c60 100644 --- a/test/src/emacs-module-resources/mod-test.c +++ b/test/src/emacs-module-resources/mod-test.c @@ -288,6 +288,8 @@ Fmod_test_return_unibyte (emacs_env *env, ptrdiff_t n= args, emacs_value args[], char large_unused_buffer[512]; }; =20 +static void signal_errno (emacs_env *, char const *); + /* Return a new user-pointer to a super_struct, with amazing_int set to the passed parameter. */ static emacs_value @@ -295,6 +297,8 @@ Fmod_test_userptr_make (emacs_env *env, ptrdiff_t nar= gs, emacs_value args[], void *data) { struct super_struct *p =3D calloc (1, sizeof *p); + if (!p) + signal_errno (env, "calloc"); p->amazing_int =3D env->extract_integer (env, args[0]); return env->make_user_ptr (env, free, p); } --=20 2.30.2 --------------F8EEEB1413B5AA2A495BA107 Content-Type: text/x-patch; charset=UTF-8; name="0004-Pacify-gcc-11.1.1-Wclobbered.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0004-Pacify-gcc-11.1.1-Wclobbered.patch" =46rom c22cf4d02ff7ebd85839aac5336f6e279f32db54 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 12 Jul 2021 00:07:38 -0700 Subject: [PATCH 4/5] Pacify gcc 11.1.1 -Wclobbered * src/eval.c (Fprogn, internal_lisp_condition_case): Add CACHEABLE to work around more instances of -Wclobbered bug. --- src/eval.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/eval.c b/src/eval.c index 18faa0b9b1..b76ced79d6 100644 --- a/src/eval.c +++ b/src/eval.c @@ -462,7 +462,7 @@ DEFUN ("progn", Fprogn, Sprogn, 0, UNEVALLED, 0, usage: (progn BODY...) */) (Lisp_Object body) { - Lisp_Object val =3D Qnil; + Lisp_Object CACHEABLE val =3D Qnil; =20 while (CONSP (body)) { @@ -1429,7 +1429,7 @@ internal_lisp_condition_case (Lisp_Object var, Lisp= _Object bodyform, } } =20 - Lisp_Object result =3D eval_sub (bodyform); + Lisp_Object CACHEABLE result =3D eval_sub (bodyform); handlerlist =3D oldhandlerlist; if (!NILP (success_handler)) { --=20 2.30.2 --------------F8EEEB1413B5AA2A495BA107 Content-Type: text/x-patch; charset=UTF-8; name="0005-Port-test-module-to-glibc-2.33.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0005-Port-test-module-to-glibc-2.33.patch" =46rom a79c578f3d77101964b837e8fa8b8109f21c7a88 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 12 Jul 2021 00:11:22 -0700 Subject: [PATCH 5/5] Port test module to glibc 2.33 * test/Makefile.in (REPLACE_FREE, FREE_SOURCE_0, FREE_SOURCE_1): New macros. ($(test_module)): Improve accuracy of test as to whether free.c should be compiled; glibc 2.33 does not need it compiled and the compilation breaks if you try, if you build with --enable-gcc-warnings. --- test/Makefile.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/Makefile.in b/test/Makefile.in index c1518d3dcd..7047c24482 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -49,6 +49,8 @@ SEPCHAR =3D =20 HAVE_NATIVE_COMP =3D @HAVE_NATIVE_COMP@ =20 +REPLACE_FREE =3D @REPLACE_FREE@ + -include ${top_builddir}/src/verbose.mk =20 # Load any GNU ELPA dependencies that are present, for optional tests. @@ -274,6 +276,9 @@ MODULE_CFLAGS =3D test_module =3D $(test_module_dir)/mod-test${SO} src/emacs-module-tests.log src/emacs-module-tests.elc: $(test_module) =20 +FREE_SOURCE_0 =3D +FREE_SOURCE_1 =3D $(srcdir)/../lib/free.c + # In the compilation command, we can't use any object or archive file # as source because those are not compiled with -fPIC. Therefore we # use only source files. @@ -282,7 +287,7 @@ $(test_module): $(test_module: $(AM_V_CCLD)$(CC) -shared $(CPPFLAGS) $(MODULE_CFLAGS) $(LDFLAGS) \ -o $@ $< $(LIBGMP) \ $(and $(GMP_H),$(srcdir)/../lib/mini-gmp-gnulib.c) \ - $(if $(OMIT_GNULIB_MODULE_free-posix),,$(srcdir)/../lib/free.c) \ + $(FREE_SOURCE_$(REPLACE_FREE)) \ $(srcdir)/../lib/timespec.c $(srcdir)/../lib/gettime.c endif =20 --=20 2.30.2 --------------F8EEEB1413B5AA2A495BA107--