| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:mime-version:in-reply-to:references:from:date | |
| :message-id:subject:to:content-type; q=dns; s=default; b=sC+4lU+ | |
| pCJnJzqTazLSQYqN9Y+lJTz2CJE8eercPtZJEMcYPGDlP/mlGQEGrlEi54zRCbsz | |
| Svrw7c6l0rdPwkL6ywt/ivqsxR3cQQI0cFlIEqeFrG5BrHdcU2WxBuVTVxf4SZo4 | |
| YP8JEV9DvyyChcZeAXWMi07XMdO4oVLTQa3s= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:mime-version:in-reply-to:references:from:date | |
| :message-id:subject:to:content-type; s=default; bh=9LnOVgouD59J4 | |
| i50fES1gQ5zGYI=; b=Hrj249ib/5vyw+JQZJwoVLZVXjyb0sO+oN+RUwxzebv3/ | |
| COiNdXgsvKzTEiTTFhrWrCoC6PMdBQEm3/cRLslyFYw7JXwy9E0md6xJTfUz+bTt | |
| IsDgAmFPs/7SoyOetfDsWgB9ykMRkqH0/re7UVyJGoG38nP0k9Af1jreCTCkaw= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Authentication-Results: | sourceware.org; auth=none |
| X-Virus-Found: | No |
| X-Spam-SWARE-Status: | No, score=-1.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy= |
| X-HELO: | mail-yb0-f180.google.com |
| X-Google-DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=0oVEPdL9/93T8dF+7H9FXjovm3Zzt5ZnOdYxWtNnQgk=; b=ASyxCiMMn5FeCe/RFttrBIFQWKVnJbKS2Ba2Pf9dFu9CsEjZYl9OrXRAKGsetMjSSe Q2a+w1Bnk6SYhsfm9LGauO7FLqyzefyE7MLrqL9radrCwyYIVZ4R1bhEU/A/0OSVSha6 NyaXwtxMGWVCFEagCtNWvb+k498hZ7TbqvoumRP5pa+T35v/KcRFJI8PuIX2gUZlsnOU Hdkk/roChddiuuoRxRHVIDXzE70LBydPyUafozAca9SWTgQX9Wxm7yjsHk6BgHbnglxM VdZNIx0y+Y+/Dy7R/K5eoAvxz7agw5Gxc6t7f3HIW9CPp3S4zKIrsutVWtJiIn2rMa+8 BXKA== |
| X-Gm-Message-State: | AODbwcCYKVXw2ZvbBeTLNUfB8XL/CwosNBQTo712F3dA6ljF1yR31eI0 6Q46DtXF0biw1Bk6+xSa6nyePqps6Z8V |
| X-Received: | by 10.37.180.154 with SMTP id o26mr10089552ybj.10.1495794511607; Fri, 26 May 2017 03:28:31 -0700 (PDT) |
| MIME-Version: | 1.0 |
| In-Reply-To: | <fcf6ac78-b7b2-340d-a9a5-7c75738cedac@redhat.com> |
| References: | <6f28f46906804c6f8f6b4b861e202492 AT CASMBX02 DOT oslo DOT ngi DOT no> <d252aaae-b298-6fc8-7e5b-8d8be9f27f21 AT redhat DOT com> <CAOTD34Y=0udiWCAmkyEywJA6=NrUkG-T9hqXNHWckMbgkdmn_w AT mail DOT gmail DOT com> <CAOTD34YW5KoSH3unhrHfEW7Ni8-DGOPsiXNTwn75UwOhdUfVbg AT mail DOT gmail DOT com> <fcf6ac78-b7b2-340d-a9a5-7c75738cedac AT redhat DOT com> |
| From: | Erik Bray <erik DOT m DOT bray AT gmail DOT com> |
| Date: | Fri, 26 May 2017 12:28:31 +0200 |
| Message-ID: | <CAOTD34bucA3RAOMLyFP9HN1dnoTTdk73=zcCGyaGdgvCmyp9sg@mail.gmail.com> |
| Subject: | Re: bug in lrint [was: FW: Printing long int in C program under cygwin64] |
| To: | cygwin AT cygwin DOT com |
| X-IsSubscribed: | yes |
On Wed, May 24, 2017 at 6:57 PM, Eric Blake wrote:
> On 05/24/2017 11:53 AM, Erik Bray wrote:
>
>>>> dropping down to assembly; it could very well be that the assembly code
>>>> is incorrectly truncating things at 32 bits (where it is just fine for
>>>> 32-bit Cygwin, but wrong for 64-bit):
>>>>
>>>> long lrint (double x)
>>>> {
>>>> long retval = 0L;
>>>> #if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) ||
>>>> defined(__i386__)
>>>> __asm__ __volatile__ ("fistpl %0" : "=m" (retval) : "t" (x) : "st");
>
>> Actually, I take it back. gdb/objdump (and presumably binutils in
>> general) was being deceptive to me about the nature of that mov
>> instruction. And in fact the fistpl should be fistpq. That fixes it.
>
> Is fistpq right on 32-bit, or is this a case where we need different
> assembly for 32-bit (fistpl) vs. 64-bit (fistql) to match the size of
> long that we are converting to?
Right. I didn't read that pre-processer line past the first couple
defines. Really this should be fistpq on 64-bit and fistpl on 32-bit.
And if llrint has the same bug then it should be fixed there too.
The discussion about printf format specifiers is orthogonal to this.
I can submit a patch for l(l)rint if you'd like.
Erik
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |