delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/10/08/12:15:28

DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 498GFSTY076476
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=HSK9vdqz
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 27583385DDDD
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1728404126;
bh=Dv9nwd2SKGg0r8xw96gyl39oLW+Rt9HGO5+M5aUOZmY=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=HSK9vdqzN+RcjTGFgobXlqzerD39urfvStZgn4vmJXIOw/3s3eBOcyFgB9jufE0Eg
jo7KoeiiFQdU+iu9+Usmc7kHzEU1YMWUJ2PsE1wfTCojmI9s3zN5IJf/3dLKNrZonK
KlDd53RIZhMCDQ//rrdFkFG2HfiD9nQCHZwUmB2o=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ACE823858CDB
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org ACE823858CDB
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728404101; cv=none;
b=PJ6EPdyGtxPM3sMlBJWZkR+OjvMg56kFLcGbv5ENJtn6Qtz93cBL4/3js1LW153ML8phsSyZFx6fgSfVw1XlFrPo0esBVzlRt7uClhS4Z8fmyEhcDmSoqO2c3hVooW5qgyg1KGG5acuumcr8g3OfVGLxIcNq4Os+W23mQe75rNg=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1728404101; c=relaxed/simple;
bh=9G6GDgJKuYj8GU4HJzTLR/9UXSP73Nzy1tWwq5ewHZo=;
h=Message-ID:Date:MIME-Version:Subject:To:From;
b=TDtGVTY9L42kTtWuRwGI7OnGl/k6wru8N7o0wga2kUgg6ze2JU3cAlYAsUXrHnjNFqrlJDCIGFdz5l2phy1b7bEzi4uIVYTC9lmpg6C6EgNwROig6+21hrc8u6EhGWZxXXo7ZIFTO7qFKOK/p7jiNrlcyPJzMKv/8/5BAmXSiqw=
ARC-Authentication-Results: i=1; server2.sourceware.org
Message-ID: <79171662-eede-4b14-aaf4-ebd98e6d98de@SystematicSW.ab.ca>
Date: Tue, 8 Oct 2024 10:14:56 -0600
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: cygwin 3.5.4-1: signal handling destroys 'long double' values
To: cygwin AT cygwin DOT com
References: <922a6d7e-3ee1-9bb7-dfd7-b94c53a7b9d4 AT t-online DOT de>
<20241008202057 DOT abd3dc5bb4df172c530e7655 AT nifty DOT ne DOT jp>
Organization: Systematic Software
In-Reply-To: <20241008202057.abd3dc5bb4df172c530e7655@nifty.ne.jp>
X-Rspamd-Queue-Id: C4E302F
X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00, BODY_8BITS,
KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,
SPF_PASS, TXREP,
UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6
X-Rspamd-Server: rspamout07
X-Stat-Signature: yg1z3s1xrxrogs8daeq3zbi8s8s8m3dm
X-Session-Marker: 427269616E2E496E676C69734053797374656D6174696353572E61622E6361
X-Session-ID: U2FsdGVkX1/1+W32YmfAGNjzAxrf99D936XIeHYBBmE=
X-HE-Tag: 1728404097-274365
X-HE-Meta: U2FsdGVkX18B/B8gAXUQVppTLXiR2WgAiFYfEmKzCuEyOVAcmZmyOJR28BBe0vq2Tp3nI7cIGogesP8kWhPD/zn3ICkT3BRa6BW9R0BtCxu+Bic6L4O3Vio+f51+O8jTLX51lt1Bk4rKMfmY1VTHW4fn8XSXTK1W48zrYfHll8Dsk+C4Tg9lXbIZVdlw4pnyK343tb3YBkS3EuwTd6jkYtZvlzbdmX835TyoodsR+ScOHKGd5G7DqsYZJQ7hZe0DAGzHmmbiy7ffBY4lOMPyerd1yQVQ1YUBfwSavMm53oqT81DwiUH+wlo4+HHDM/MdthclcneN8iUFd6Qt787XOc7cPyZ8g3mf23sS8iRFTMuYpCM0OEydzTqULHfLaEeUd9SVfy5I5+R8EFydECaHVw==
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Brian Inglis via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Brian Inglis <Brian DOT Inglis AT SystematicSW DOT ab DOT ca>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 498GFSTY076476

On 2024-10-08 05:20, Takashi Yano via Cygwin wrote:
> On Mon, 7 Oct 2024 15:11:52 +0200
> Christian Franke wrote:
>> $ gcc -o sigtest -O2 sigtest.c
>>
>> $ ./sigtest > out.txt
>> (press ^C 42x :-)
>>
>> $ sort out.txt | uniq -c
>>         3 x = 0x1.23456789p+0, y = -nan, d = -nan
>>         6 x = 0x1.23456789p+0, y = 0x1.23456789p+0, d = -nan
>>        33 x = 0x1.23456789p+0, y = 0x1.23456789p+0, d = 0x0p+0
>>
>> The problem also occurs if compiled without -O2, but less often. No
>> problem occurs if compiled with -DWORKS which suggests that only 'long
>> double' is affected.
> 
> Thanks for the report. I looked into this problem and might find the
> cause. It seems due to a bug of scripts/gendef. It generates signal
> handler caller (sigfe.s) which stores/restores the registers.
> 
> In sigdelayed, control word is stored/restored by fnstcw/fldcw instruction,
> however, fninit instruction destroys some status registers in FPU (x87).
> 
> I think we shold use fnstenv/fldenv rather than fnstcw/fldcw and fninit.
> However, I'm not familiar with x87 instructions, so I may overlook
> something.
> 
> Could anyone expert of x87 instructions and sigfe stuff give some
> comments?

AIUI x87 FP handling is outdated and mainly unused on current systems, as 
current systems do more and use more than the legacy x87 instructions and stack.

See https://en.cppreference.com/w/c/numeric/fenv and related docs for more 
modern approaches.

You would have to look into the AMD/Intel/IEEE docs for lower level details.

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019