GNU bug report logs - #72145
rare Emacs screwups on x86 due to GCC bug 58416

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Tue, 16 Jul 2024 23:27:02 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


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

From: Pip Cet <pipcet <at> protonmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 72145 <at> debbugs.gnu.org, rms <at> gnu.org
Subject: Re: bug#72145: rare Emacs screwups on x86 due to GCC bug 58416
Date: Thu, 18 Jul 2024 15:19:55 +0000
On Thursday, July 18th, 2024 at 12:38, Paul Eggert <eggert <at> cs.ucla.edu> wrote:
> On 2024-07-17 20:22, Richard Stallman wrote:
> 
> > > * Rewrite Emacs to never use 'double' (or 'float' or 'long double')
> > > inside a union. This could be painful and hardly seems worthwhile.
> > 
> > Where does Emacs use those types inside a union?
> > Maybe this is not difficult.
> 
> 
> I found the bug in src/timefns.c, which uses a union to represent
> timestamp forms (one of which represents an Emacs float). Other uses
> that come to mind are src/lisp.h's struct Lisp_Float, which uses a union
> to save space when representing Lisp floats, and src/lread.c's and
> src/print.c's use of <ieee754.h>'s unions to deal with NaNs when reading
> 
> and printing Lisp floats. Although I have not done an audit I expect
> there are other places too, and I expect it would take some time to
> audit, rewrite and thoroughly test Emacs to not use floating point in
> these places, with runtime performance degraded somewhat as a result.
> 
> Although that effort might be worth it if the bug was likely and there
> was no other workaround, the bug is quite rare (we've lived with it for
> decades and I'm the first person to notice it, or at least track it
> down), and with the proposed compiler-flag workaround the remaining
> affected platforms are so obsolescent (decades-old CPUs) that they're
> also rare. I doubt whether it's worth significantly contorting the C
> code (possibly introducing bugs on mainstream platforms) to fix these
> exceedingly rare bugs in obsolescent platforms.

It should be mentioned that this isn't just about the CPU: the OS also needs to enable the XMM register set, right? That means we might end up dropping support for many old platforms as well as old CPUs and emulators, and I'm not sure that's a good idea.

Pip




This bug report was last modified 276 days ago.

Previous Next


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