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#72145: rare Emacs screwups on x86 due to GCC bug 58416 Date: Thu, 18 Jul 2024 05:38:26 -0700 Organization: UCLA Computer Science Department Message-ID: <01f0f261-60af-4282-ae1b-9f3c4e8b2ed3@cs.ucla.edu> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10952"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 72145@debbugs.gnu.org To: rms@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 18 14:39:15 2024 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 1sUQPi-0002f0-G6 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 18 Jul 2024 14:39:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sUQPU-00079p-Nd; Thu, 18 Jul 2024 08:39:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sUQPT-000785-7d for bug-gnu-emacs@gnu.org; Thu, 18 Jul 2024 08:38:59 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sUQPS-0008J5-UX for bug-gnu-emacs@gnu.org; Thu, 18 Jul 2024 08:38:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sUQPW-0000xu-Cq for bug-gnu-emacs@gnu.org; Thu, 18 Jul 2024 08:39: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: Thu, 18 Jul 2024 12:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72145 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 72145-submit@debbugs.gnu.org id=B72145.17213063203667 (code B ref 72145); Thu, 18 Jul 2024 12:39:02 +0000 Original-Received: (at 72145) by debbugs.gnu.org; 18 Jul 2024 12:38:40 +0000 Original-Received: from localhost ([127.0.0.1]:37122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sUQPA-0000x4-0o for submit@debbugs.gnu.org; Thu, 18 Jul 2024 08:38:40 -0400 Original-Received: from mail.cs.ucla.edu ([131.179.128.66]:51010) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sUQP7-0000wl-Hs for 72145@debbugs.gnu.org; Thu, 18 Jul 2024 08:38:38 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 25D743C011BC5; Thu, 18 Jul 2024 05:38:27 -0700 (PDT) Original-Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id hoNk3WA9pFDr; Thu, 18 Jul 2024 05:38:26 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 927253C011BD8; Thu, 18 Jul 2024 05:38:26 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 927253C011BD8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1721306306; bh=ZPhsuQAFV3QgZ2OU4R7dDrX/oB+jWsxlpw4iVWiR6UQ=; h=Message-ID:Date:MIME-Version:To:From; b=YzgVoGEwaqlCgPc9b1MG5EfWDBUSJQTCdUAqxf9J+fxPLP9MHlEG9DLB27j5hyqqK IEjZ31vgAVSINaeHkMCvIzMSAkTd1ytStSz/WPBap2W6tm5XB9pEfiWz9FwB+IgM5V Fk1R05JUi2XPW9IHAKXaeAJcPPNV1owrpNWN2OvEx3MTl0ZHMVUuYaOQPuO16PQQlB Pi7WFw33RYemw4YUzTFd7y0aHrOFNwftvTPBjuVm91T+inFdDNqmkxgBNna4PmnjXR Hkm0BDk51uPXfRNKWkDnG/qi4jCv1lPBRsgk/kv2a/43TZA87FZAqFmTtb/dI3+ltF fHtObZTxKW31g== X-Virus-Scanned: amavis at mail.cs.ucla.edu Original-Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id Kkt5UZgfV5w4; Thu, 18 Jul 2024 05:38:26 -0700 (PDT) Original-Received: from [192.168.254.12] (unknown [47.154.17.165]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 73D5B3C011BC5; Thu, 18 Jul 2024 05:38:26 -0700 (PDT) Content-Language: en-US In-Reply-To: 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:288964 Archived-At: 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 '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.