X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E2A8F385783D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1598899523; bh=V6ur9E9OTqHLcjH/uj0jArVcjbhQNtNef5l4BQ5SvyI=; h=Date:From:To:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Reply-To:From; b=i04sJSzZUAz9OSBCp3YTzxOoO8wVYt0FJr8PByvpnLw/Ib6kfr/GI7IBCjnSc4TNl zOkVmhTYPAA915e+D18AP+2A4Ic0t9nZKYtPif1XL6SQ3L9Hsu4X18+zZNsfc0IYFd r5Q28Jr41zUE4hKaDYUKj+KLEfFVPon4IECI/3qw= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AF4A53857823 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cygwin.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=corinna-cygwin AT cygwin DOT com Date: Mon, 31 Aug 2020 20:45:17 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: cpp /usr/include/threads.h fails; modfl segfaults Message-ID: <20200831184517.GF3272@calimero.vinschen.de> Mail-Followup-To: cygwin AT cygwin DOT com References: <02b16d2e-9d51-de58-807b-3b31b2565b59 DOT ref AT aol DOT com> <02b16d2e-9d51-de58-807b-3b31b2565b59 AT aol DOT com> <20200830130005 DOT GR3272 AT calimero DOT vinschen DOT de> <20200831073500 DOT GU3272 AT calimero DOT vinschen DOT de> <36f6cc1b-1944-f1b6-b832-33205c08bbae AT SystematicSw DOT ab DOT ca> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <36f6cc1b-1944-f1b6-b832-33205c08bbae@SystematicSw.ab.ca> X-Provags-ID: V03:K1:699o0w8iwV1F1FQtHpc9atp0E1mgWFXCedMjYPlnzH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h0MVLTO4dccjH62BrQ6blzqCd2n1bNk +aikdHDRCtWmKW+XY1Kw== X-Spam-Status: No, score=-105.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, GOOD_FROM_CORINNA_CYGWIN, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: cygwin AT cygwin DOT com Content-Type: text/plain; charset="utf-8" Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 07VIjnn2030432 On Aug 31 09:37, Brian Inglis wrote: > On 2020-08-31 01:35, Corinna Vinschen wrote: > > On Aug 30 14:39, Brian Inglis wrote: > >> On 2020-08-30 07:00, Corinna Vinschen wrote: > >>> On Aug 29 08:52, airplanemath via Cygwin wrote: > >>>> I have two reports.  A brief description of the system: > >>>> $ uname -a | sed "s/${HOSTNAME}/\${HOSTNAME}/g" > >>>> CYGWIN_NT-10.0 ${HOSTNAME} 3.1.7(0.340/5/3) 2020-08-22 17:48 x86_64 Cygwin > >> ... > >>>> $ cat test.c > >>>> #include > >>>> #include > >>>> #include > >>>> > >>>> int main(int argc, char *argv[]) { > >>>>   long double a, b, c; > >>>>   char *num_end = NULL; > >>>>   a = b = c = 0.0L; > >>>>   if (argc != 2) { > >>>>     fprintf(stderr, "Usage: %s NUMBER\n", argv[0]); > >>>>     exit(1); > >>>>   } > >>>>   a = strtold(argv[1], &num_end); > >>>>   b = modfl(a, &c); > >>>>   printf("%Lf %Lf %Lf\n", a, b, c); > >>>>   return 0; > >>>> } > >>> > >>> This is a bug in the assembler code taken from Mingw-w64. The bug has > >>> been fixed upstream, so I just pulled in the upstream fixes. > >> > >> The 64 bit fix doesn't pop eax but *now* flags eax as clobbered, whereas the 32 > >> bit fix both pops and *now* flags eax as clobbered, which it really doesn't need > >> to do. Is this inconsistent treatment correct? > > > > You may be right that this is not necessary on i686, but it doesn't > > hurt either and I'd like to stick to the upstream code if possible. > > The upstream patch changed only amd64/x86_64 code sequences for multiple modules > including modfl, and left i386/x86 untouched for those modules. $ git remote -v origin https://git.code.sourceforge.net/p/mingw-w64/mingw-w64 (fetch) origin https://git.code.sourceforge.net/p/mingw-w64/mingw-w64 (push) $ git st On branch master Your branch is up to date with 'origin/master'. nothing to commit, working tree clean $ $ git log --oneline -2 -- mingw-w64-crt/math/modfl.c fac3a8a6e4ca crt: Add "volatile" to all inline assembly snippets under math 9a2479858b3b mingw-w64-crt/math/modf{,f,l}.c: Fix segment faults in modf(), modff() and modfl(). $ git show 9a2479858b3b [...] diff --git a/mingw-w64-crt/math/modfl.c b/mingw-w64-crt/math/modfl.c index af75a8b8cf60..ef1ab16ce256 100644 --- a/mingw-w64-crt/math/modfl.c +++ b/mingw-w64-crt/math/modfl.c @@ -21,7 +21,7 @@ modfl (long double value, long double* iptr) "fldcw (%%rsp)\n" "frndint\n" "fldcw 4(%%rsp)\n" - "addq $8, %%rsp\n" : "=t" (int_part) : "0" (value)); /* round */ + "addq $8, %%rsp\n" : "=t" (int_part) : "0" (value) : "eax"); /* round */ #elif defined(_X86_) || defined(__i386__) asm ("push %%eax\n\tsubl $8, %%esp\n" "fnstcw 4(%%esp)\n" @@ -31,7 +31,7 @@ modfl (long double value, long double* iptr) "fldcw (%%esp)\n" "frndint\n" "fldcw 4(%%esp)\n" - "addl $8, %%esp\n\tpop %%eax\n" : "=t" (int_part) : "0" (value)); /* round */ + "addl $8, %%esp\n\tpop %%eax\n" : "=t" (int_part) : "0" (value) : "eax"); /* round */ #else int_part = truncl(value); #endif Corinna -- Corinna Vinschen Cygwin Maintainer -- 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