From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23307 invoked by alias); 24 May 2017 16:57:32 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 23275 invoked by uid 89); 24 May 2017 16:57:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*f:sk:CAOTD34, H*i:sk:CAOTD34 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 24 May 2017 16:57:29 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 32F8081226 for ; Wed, 24 May 2017 16:57:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 32F8081226 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=eblake@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 32F8081226 Received: from [10.10.122.27] (ovpn-122-27.rdu2.redhat.com [10.10.122.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id E04D21710F for ; Wed, 24 May 2017 16:57:31 +0000 (UTC) Subject: Re: bug in lrint [was: FW: Printing long int in C program under cygwin64] To: cygwin@cygwin.com References: <6f28f46906804c6f8f6b4b861e202492@CASMBX02.oslo.ngi.no> From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Message-ID: Date: Wed, 24 May 2017 17:40:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="WAGAV97574n0UV6uImtO5ivQA9uVXSmjW" X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg00394.txt.bz2 --WAGAV97574n0UV6uImtO5ivQA9uVXSmjW Content-Type: multipart/mixed; boundary="aBJou2fKOCLpQusCMPa45nVoePSntoWoL"; protected-headers="v1" From: Eric Blake To: cygwin@cygwin.com Message-ID: Subject: Re: bug in lrint [was: FW: Printing long int in C program under cygwin64] References: <6f28f46906804c6f8f6b4b861e202492@CASMBX02.oslo.ngi.no> In-Reply-To: --aBJou2fKOCLpQusCMPa45nVoePSntoWoL Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Content-length: 977 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 =3D 0L; >>> #if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || >>> defined(__i386__) >>> __asm__ __volatile__ ("fistpl %0" : "=3Dm" (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? --=20 Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org --aBJou2fKOCLpQusCMPa45nVoePSntoWoL-- --WAGAV97574n0UV6uImtO5ivQA9uVXSmjW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" Content-length: 604 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJZJbt2AAoJEKeha0olJ0Nqx70H/jeyZ5MOh7tIAcMtqmSLOs3Q h6lAOjJ/wt+0Ea6ZTj9l0+/N4MHMg+E3aDt2/L+e3wk7uyxfCbhG5cXKBZDnltGK t4Ni3M12J7Qxi04VaBh317lY7N+gc+pi+OUkoaBEhF5Alrxhvm3JriDm7suNZJWh Pr8XGle/j/JVfQmbBgRQGBpxEqtsMHnPU/Bw55SdDgBTlEdVPcrO/u0HTdUKSXyZ YibY6Rx3Q9sycKmA88MWWgAShAvHHJHFlDEEN6Vg2z1pXbCesP1TQT1+n9xwAnC0 8FET7XiXNXIk2eN1kB+TtSIjlWeZ41+kXCP2ATwqdB3P7aWv9/4D2uKuXIxu6nE= =blvd -----END PGP SIGNATURE----- --WAGAV97574n0UV6uImtO5ivQA9uVXSmjW--