GNU bug report logs - #75451
scratch/igc: Enable CHECK_STRUCTS

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefankangas <at> gmail.com>

Date: Thu, 9 Jan 2025 03:58:02 UTC

Severity: wishlist

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #112 received at 75451 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Pip Cet <pipcet <at> protonmail.com>
Cc: Gerd Möllmann <gerd.moellmann <at> gmail.com>,
 Gerd Moellmann <gerd <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>,
 75451 <at> debbugs.gnu.org
Subject: Re: bug#75451: scratch/igc: Enable CHECK_STRUCTS
Date: Mon, 27 Jan 2025 16:30:54 -0800
[Message part 1 (text/plain, inline)]
On 1/27/25 03:07, Pip Cet wrote:
> "Paul Eggert" <eggert <at> cs.ucla.edu> writes:
> 
>> GCC complained in my builds after some pdumper.c changes were added
>> today in this area. I pacified GCC by installing the attached further
> 
> Did you build with optimization?

Yes.  --enable-gcc-warnings doesn't make much sense otherwise.


> . we lose the -Wswitch warning entirely this way.

Yes, unfortunately (and as I mentioned in the commit message).


> 2. GCC generates an equivalent table itself when building with
> optimization, if it can do so.

Heh, I didn't know that. Though I didn't see that in my little tests 
when compiling with default -O2 optimization. For example, if I compile 
the attached with gcc -std=gnu23 -O2 -S, 'dotab' has one indexed jump 
whereas 'doswitch' has three conditional branches. Not clear to me which 
is faster in practice. I used x86-64 gcc (GCC) 14.2.1 20250110 (Red Hat 
14.2.1-7).


> The warnings are annoying, so maybe we should go back to the "default:
> emacs_abort();" solution for now, or switch to "default: eassume (0);"

Between the two I would prefer the latter. "default: eassume (false);" 
will crash reliably if you use compiler flags like -fsanitize=undefined, 
and that should be good enough for this sort of thing.
[t.c (text/x-csrc, attachment)]

This bug report was last modified 105 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.