From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X21pV-0003qM-9n for qemu-devel@nongnu.org; Tue, 01 Jul 2014 13:26:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X21pP-00084v-8U for qemu-devel@nongnu.org; Tue, 01 Jul 2014 13:26:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13359) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X21pO-00084i-Uo for qemu-devel@nongnu.org; Tue, 01 Jul 2014 13:26:47 -0400 Message-ID: <53B2EF4E.4050005@redhat.com> Date: Tue, 01 Jul 2014 11:26:38 -0600 From: Eric Blake MIME-Version: 1.0 References: <1404202956-30657-1-git-send-email-pbonzini@redhat.com> <1404202956-30657-4-git-send-email-pbonzini@redhat.com> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="rnew2FMWErlPuBv36AKLqvXIDGBcDPlvV" Subject: Re: [Qemu-devel] [PULL 3/3] configure: Fix -lm test, so that tools can be compiled on hosts that require -lm List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Paolo Bonzini Cc: Alexey Kardashevskiy , QEMU Developers This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --rnew2FMWErlPuBv36AKLqvXIDGBcDPlvV Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/01/2014 02:26 AM, Peter Maydell wrote: > On 1 July 2014 09:22, Paolo Bonzini wrote: >> From: Alexey Kardashevskiy >> >> The existing test whether "-lm" needs to be included or not is >> insufficient as it reports false negative on Fedora20/ppc64. >> This happens because sin(0.0) is a constant value which compiler >> can safely throw away and therefore there is no need to add "-lm". >> As the result, qemu-nbd/qemu-io/qemu-img tools cannot compile. >> >> This adds a global variable and uses it in the test to prevent >> from optimization. >=20 >> --- a/configure >> +++ b/configure >> @@ -3453,7 +3453,7 @@ fi >> # Do we need libm >> cat > $TMPC << EOF >> #include >> -int main(void) { return isnan(sin(0.0)); } >> +double x; int main(void) {return isnan(sin(x));} >> EOF >> if compile_prog "" "" ; then >> : >=20 > This looks to me like we're leaving ourselves open for > a smarter compiler with linktime optimisation to complain > that x is used uninitialized. If that's your worry, what about: int main(int argc, char **argv) { return isnan(sin(argc > 1)); } --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --rnew2FMWErlPuBv36AKLqvXIDGBcDPlvV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTsu9OAAoJEKeha0olJ0Nqt30IAJSRb/1u+OdH7KfAYLRx5MaI Ug15fOmFJDW9pjRPqCsGv2W1DjgxWd6RrLoYb1ei0LeEknBObD3fMqrtILy6mZhV 1lO+pfYox5AbMXci68p8YC4XA/2izzSZjDYVT7SXTfYzu4PaTzlLnU/BtdWmZYJF Fr6+nAegYPoi6UH5YDEhUWeJeXutj+CP+z+SxCynJPEJNZU6cenGrGJ97kXDTlfc Xp4Ux/2B6NDjcFN2giXNmqqlXgnGK/VWo/A5DPGiF1EZiu1QqJ/kAfXiNK1RqWVa 1q7mrU4EfjPhUX++wjNROXrgy/3aRiwhViUPDaCXTjofb6bJNALPDZTMjX7HWjg= =0G6x -----END PGP SIGNATURE----- --rnew2FMWErlPuBv36AKLqvXIDGBcDPlvV--