unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: rms@gnu.org
Cc: 72145@debbugs.gnu.org
Subject: bug#72145: rare Emacs screwups on x86 due to GCC bug 58416
Date: Thu, 18 Jul 2024 05:38:26 -0700	[thread overview]
Message-ID: <01f0f261-60af-4282-ae1b-9f3c4e8b2ed3@cs.ucla.edu> (raw)
In-Reply-To: <E1sUHiZ-0005qB-7B@fencepost.gnu.org>

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.






  reply	other threads:[~2024-07-18 12:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-16 23:26 bug#72145: rare Emacs screwups on x86 due to GCC bug 58416 Paul Eggert
2024-07-17  0:57 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-17  5:01   ` Paul Eggert
2024-07-17 21:56     ` Paul Eggert
2024-07-18  2:39       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-18  5:14         ` Eli Zaretskii
2024-07-18  3:22 ` Richard Stallman
2024-07-18 12:38   ` Paul Eggert [this message]
2024-07-18 15:19     ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-19 21:31       ` Paul Eggert
2024-08-22  6:44         ` Paul Eggert
2024-07-18 14:19 ` Andrea Corallo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=01f0f261-60af-4282-ae1b-9f3c4e8b2ed3@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=72145@debbugs.gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).