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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=VLoROnp6z3vdsoScp0cvGU9OGHaQthhmeacZavb3NxnkcKbm4/wPx Q457jjyQJ5Ignk66A9Jb7rsYA6tLmGy3CbKC+exQ6tntGKJysLC/Ok4WYgUNWrZQ Zk5D8EKO6EPYSqfskIIvZtmJoAfoEN1/UkjF/mote+wJbi4wIZ0eaQ= 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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=JCxlQj66KzeU0r2dJNppdekgZl8=; b=AEspIvOSb+NW9xNnwjv6l4D/96L6 XpjAQPtC2UWoGFKKADL6nC4EMo4lkjSHSMgRdOYMdhYAi8wN/cQiNZKiMEqE5aug lArFrGFOMklymghL2OAxOjS6RWlXDqZI+17h0TLcu1aY9gmOmfdoKinbs83CptpC LS34CK7GoNmOgZU= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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=-101.9 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Blake, blake, H*c:application X-HELO: drew.franken.de Date: Wed, 7 Jun 2017 11:10:19 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: bug in lrint [was: FW: Printing long int in C program under cygwin64] Message-ID: <20170607091019.GA5971@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <6f28f46906804c6f8f6b4b861e202492 AT CASMBX02 DOT oslo DOT ngi DOT no> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="h31gzZEtNLTqOjlF" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.0 (2017-02-23) --h31gzZEtNLTqOjlF Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On May 24 07:33, Eric Blake wrote: > On 05/24/2017 07:00 AM, Carl Fredrik Forsberg wrote: > > type cast lrint(-1.0) =3D 4294967295 >=20 > Now that's an interesting one - it may be that cygwin1.dll actually has > buggy behavior in lrint(). In the source code, cygwin/math/lrint.c is > 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): >=20 > 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"); > #elif defined(__arm__) || defined(_ARM_) > retval =3D __lrint_internal(x); > #endif > return retval; > } >=20 > But I'm not an assembly coding expert, so perhaps someone else will spot > the fix faster. I just applied a patch to fix this. Using fistpl is fine and dandy for Mingw because sizeof(long) =3D=3D 4, but on 64 bit Cygwin this function has to use fistpll to account for sizeof(long) =3D=3D 8. Thanks, Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --h31gzZEtNLTqOjlF Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJZN8L7AAoJEPU2Bp2uRE+geCwQAIXi54PkxlvNAJxC9ACbjEzz 0YJ5WJrXxDOdAEEgu89WOBdlZ65p38sCFpMnsShpDFFQ3fLIJ8HbQEkjr1lHZ5Rs OJDOPtozthDX7LxBZ+++cx3gi0nHN0i4Sq38ZAgCIe1eRPDCgWthjB5FWmDJaz8S xBJNBdhacFIsAl9nOHMNEXSPhNWBzVdwm+OlNX5pY1nEIDkTA2WYHl6KRtL8aJYg Lm+kcmeGjqiO/iHBMsSxSpKEzeq0gTK3GrPsw1UcJjeXz1USxrOiZiSY0DW9CFdq qpbwO38GyJlL63tu9n8spcVHjY6Ld9/RYUe5ZtA7+XZqv3AagVJW9f5XKgir/FLr zyjstn90fYCyStu10wIPhxXfFUI6FH6DDJtGLzTYn7G5J/3zbSgaYaOmFWA7Ku04 zQv9L8rnEhQoFkm9F9atCySf8fyxmG7VoY2lTA834z3GpJ6f2oIZuFI1eSeb2eSm rr/zahCHI3p7H/rCI4CzmyYgkddMIZ/j0+seJBTNXb42FacUewPZvRVkVFORyyfu fuOLU/ltdW2ud7yLSVgSgnn6/loM4ZE328Nu7iXlDSdCycQyXgy7JzclsPFOG0QI dNqwcs2fsQm4JqXBkRe7OVqxIjaj+lgHIcMj+NSkMXImDZyNzjPiDjHENbet2NgV yWQhZHQkhtUOSI7YsJnZ =qXBm -----END PGP SIGNATURE----- --h31gzZEtNLTqOjlF--