DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 498BLTuj4128724 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=T8J+XIvs X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7CC56385DDC1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1728386487; bh=TQWgnuMVxvFr+pEo06FKIfZGxCYPca8jLRtYKhR1OLw=; h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=T8J+XIvsAssgUGXT6X/SZGuoo8nxtbm+s1Xr4YejCAaNd/2QeeaethTWeqOpAisze L79Hrz8+KdjLrCN/hwwcZbxiiX+Ya2+9hpjojP0rUWzXTWVVzIfD+IwunCVBBCH48Q mewGO2Nyqmyg8oorQiySRpYSehhaMo9ZAZmuR0EA= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 639863858D29 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 639863858D29 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728386464; cv=none; b=DaYpdzbl3iRcK2wsAOK86a+sJx932XgeyPZaSyDZJvN2Wolz4kYaeM/xSpsaUfa0MqGTG9IjlAyeJqCnR97m9uePDM2Ip1fm/OGXOWe1vgEYxrLq9d6YnFmDPpWhRvy1unHxbge2FWRzjXu/ov5fOayKw5pnzHhAWmO9pUOieyk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728386464; c=relaxed/simple; bh=s13NF2yDeG+VTbzqKpTUCTpFHMXUaHA19A6asnalRCg=; h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature; b=UafOa91JTDJqDSrRqr28/w3CC9t8Lw1XInAHIlyBqf5/e63KWTBM1Z+puoEM1OcFe0SJ39IKHkJd4U2SB3guBzu6djUjefW3s+ngbhUFCBK8JUlsDdApX8a99ZocpiqVzD3A6ZCwrI0/YaToU3KRCLk9Tob4p9Lq8dA7wylqbjA= ARC-Authentication-Results: i=1; server2.sourceware.org Date: Tue, 8 Oct 2024 20:20:57 +0900 To: cygwin AT cygwin DOT com Subject: Re: cygwin 3.5.4-1: signal handling destroys 'long double' values Message-Id: <20241008202057.abd3dc5bb4df172c530e7655@nifty.ne.jp> In-Reply-To: <922a6d7e-3ee1-9bb7-dfd7-b94c53a7b9d4@t-online.de> References: <922a6d7e-3ee1-9bb7-dfd7-b94c53a7b9d4 AT t-online DOT de> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 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 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Takashi Yano via Cygwin Reply-To: Takashi Yano Content-Type: text/plain; charset="utf-8" Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 498BLTuj4128724 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? -- Takashi Yano -- 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