From owner-freebsd-stable@FreeBSD.ORG Wed Feb 13 12:57:20 2008 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FAA116A418 for ; Wed, 13 Feb 2008 12:57:20 +0000 (UTC) (envelope-from tevans.uk@googlemail.com) Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.189]) by mx1.freebsd.org (Postfix) with ESMTP id 1017513C43E for ; Wed, 13 Feb 2008 12:57:19 +0000 (UTC) (envelope-from tevans.uk@googlemail.com) Received: by fk-out-0910.google.com with SMTP id b27so4273fka.11 for ; Wed, 13 Feb 2008 04:57:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer; bh=6EPLrB2b1COAev/JzQRVSAGpw/PDz0iiAK+GANQgIoY=; b=hn8ynshQ3tF3IrypmUvvTXLLKbvBW4+NVEiayAgB42JhWKfYvWbXi5ULsXHv5MXZtsP300Vb66xfD85rcJgysOhXcDSM/a47dNCZvjzdI2vqohxwdn1IAR981lLlh3pYrjjWW807mSnxib18tjAuVsEjPin1S1QccFSICZP7XJM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer; b=cndrZFAYaWkYX7iHQ3J+r5cWe9QmVbvFPhi7r5Ktpcdl/G7OihkhcwKSp0GfTtv6o8VgOm7H/4/+oOy4gy9Xgn4Teu2hQyV+EK1koO8lss1L+sj3hXJ2hrvm+8B3c1Ic+yYAuUx8YQK253bFI7KAZryzlnbSXsNYB1EFe3pSF5k= Received: by 10.82.108.9 with SMTP id g9mr4823803buc.34.1202907438605; Wed, 13 Feb 2008 04:57:18 -0800 (PST) Received: from ?127.0.0.1? ( [217.206.187.79]) by mx.google.com with ESMTPS id q9sm1709414gve.10.2008.02.13.04.57.10 (version=SSLv3 cipher=RC4-MD5); Wed, 13 Feb 2008 04:57:11 -0800 (PST) From: Tom Evans To: Peter Jeremy In-Reply-To: <20080212185416.GK64299@server.vk2pj.dyndns.org> References: <1202840599.2126.86.camel@localhost> <20080212185416.GK64299@server.vk2pj.dyndns.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-TsXo89p3RKBs8jD3T9CR" Date: Wed, 13 Feb 2008 12:57:09 +0000 Message-Id: <1202907429.2126.102.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.10.2 FreeBSD GNOME Team Port Cc: freebsd-stable@freebsd.org Subject: Re: Formatting bug in C++ iostreams when running i386 binary on amd64 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Feb 2008 12:57:20 -0000 --=-TsXo89p3RKBs8jD3T9CR Content-Type: multipart/mixed; boundary="=-sRultJ6UfQu9hDfb8VIA" --=-sRultJ6UfQu9hDfb8VIA Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, 2008-02-13 at 05:54 +1100, Peter Jeremy wrote: > On Tue, Feb 12, 2008 at 06:23:18PM +0000, Tom Evans wrote: > >I've encountered a strange bug deploying one of our C++ applications on > >amd64. We tend to build most of our applications on i386, even if the > >deployment box is amd64, as we aren't 100% sure that our code is 64 bit > >clean yet. The boxes in question both run 6.2-RELEASE, at various kernel > >release patchsets: > ... > >With an i386 binary running on an amd64 host, when we write a small > >double, with value close to 0.1, to a C++ iostream, it is formatted > >incorrectly. >=20 > See kern/102424 and amd64/112222. >=20 Thanks Peter! Going on the information in those PRs, I have made a patch to the libc/gdtoa/Makefile.inc which forces gdtoa_dtoa.c to be built with -fno-gcse. This corrects the formatting bug, and allows programs to execute correctly.=20 The patch isn't quite to my liking, as it also changes how gdtoa_dtoa.c is compiled for the native 64-bit library, so ideally it would only include that additional target rule when cross-compiling the lib32 build, but I could not determine how to detect that scenario. Also, BSD make isn't my fort=C3=A9, is there a better way to add a CFLAG for a single target? Redefining the rules from share/mk/bsd.lib.mk seems fragile. I will update the PRs with my patch as well, but it is small enough to include here as well. Cheers Tom --=-sRultJ6UfQu9hDfb8VIA Content-Disposition: attachment; filename=gdtoa.diff.txt Content-Type: text/x-patch; name=gdtoa.diff.txt; charset=UTF-8 Content-Transfer-Encoding: base64 LS0tIC91c3Ivc3JjL2xpYi9saWJjL2dkdG9hL01ha2VmaWxlLmluYwlGcmkgU2VwIDI5IDE2OjE3 OjIyIDIwMDYNCisrKyAvdXNyL3NyYzIvbGliL2xpYmMvZ2R0b2EvTWFrZWZpbGUuaW5jCVdlZCBG ZWIgMTMgMTE6NDI6NTQgMjAwOA0KQEAgLTE2LDMgKzE2LDEwIEBADQogZ2R0b2FfJHtzcmN9Og0K IAlsbiAtc2YgJHsuQ1VSRElSfS8uLi8uLi9jb250cmliL2dkdG9hLyR7c3JjfSAkey5UQVJHRVR9 DQogLmVuZGZvcg0KKw0KK2dkdG9hX2R0b2EubzoNCisJJHtDQ30gJHtQT19GTEFHfSAke0NGTEFH U30gLWZuby1nY3NlIC1jIGdkdG9hX2R0b2EuYyAtbyBnZHRvYV9kdG9hLm8NCisNCitnZHRvYV9k dG9hLlNvOg0KKwkke0NDfSAke1BJQ0ZMQUd9IC1EUElDICR7Q0ZMQUdTfSAtZm5vLWdjc2UgLWMg Z2R0b2FfZHRvYS5jIC1vIGdkdG9hX2R0b2EuU28NCisNCg== --=-sRultJ6UfQu9hDfb8VIA-- --=-TsXo89p3RKBs8jD3T9CR Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQBHsukflcRvFfyds/cRAqlJAJ9PYou8IZZD6vDWbw2aGJfgkZ013ACeIa47 bH7mrtdipD1TvW64Hg9xPbw= =vuBD -----END PGP SIGNATURE----- --=-TsXo89p3RKBs8jD3T9CR--