From owner-freebsd-toolchain@FreeBSD.ORG Fri Jul 12 21:48:01 2013 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 92EA298C; Fri, 12 Jul 2013 21:48:01 +0000 (UTC) (envelope-from ohartman@zedat.fu-berlin.de) Received: from outpost1.zedat.fu-berlin.de (outpost1.zedat.fu-berlin.de [130.133.4.66]) by mx1.freebsd.org (Postfix) with ESMTP id 399A71114; Fri, 12 Jul 2013 21:48:00 +0000 (UTC) Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost1.zedat.fu-berlin.de (Exim 4.80.1) with esmtp (envelope-from ) id <1UxlC2-002rxb-V6>; Fri, 12 Jul 2013 23:47:59 +0200 Received: from g231188215.adsl.alicedsl.de ([92.231.188.215] helo=thor.walstatt.dyndns.org) by inpost2.zedat.fu-berlin.de (Exim 4.80.1) with esmtpsa (envelope-from ) id <1UxlC2-003DTm-Px>; Fri, 12 Jul 2013 23:47:58 +0200 Date: Fri, 12 Jul 2013 23:47:49 +0200 From: "O. Hartmann" To: Scot Hetzel Subject: Re: CURRENT: CLANG 3.3 and -stad=c++11 and -stdlib=libc++: isnan()/isninf() oddity Message-ID: <20130712234749.5afa3c9b@thor.walstatt.dyndns.org> In-Reply-To: References: <20130710155809.0f589c22@thor.walstatt.dyndns.org> <20130710183315.725dfde0@thor.walstatt.dyndns.org> <20130710203200.5359fd18@thor.walstatt.dyndns.org> <51DDC04B.6040209@FreeBSD.org> <20957.49978.73666.392417@khavrinen.csail.mit.edu> <20130711130043.R920@besplex.bde.org> <20130711202908.L84170@besplex.bde.org> Organization: FU Berlin X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.19; amd64-portbld-freebsd10.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/ZSAD9CXLaxRHx01iUtdTl3B"; protocol="application/pgp-signature" X-Originating-IP: 92.231.188.215 Cc: "freebsd-toolchain@FreeBSD.org" , Garrett Wollman , FreeBSD CURRENT , Bruce Evans , Tijl Coosemans , "freebsd-standards@FreeBSD.org" X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2013 21:48:01 -0000 --Sig_/ZSAD9CXLaxRHx01iUtdTl3B Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Fri, 12 Jul 2013 12:13:58 -0500 Scot Hetzel wrote: > On Fri, Jul 12, 2013 at 11:16 AM, Scot Hetzel > wrote: > > On Thu, Jul 11, 2013 at 9:33 AM, David Chisnall > > wrote: > >> On 11 Jul 2013, at 13:11, Bruce Evans wrote: > >> > >>> The error message for the __builtin_isnan() version is slightly > >>> better up to where it says more. > >>> > >>> The less-unportable macro can do more classification and detect > >>> problems at compile time using __typeof(). > >> > >> The attached patch fixes the related test cases in the libc++ test > >> suite. Please review. > >> > > > > #define fpclassify(x) \ > > - ((sizeof (x) =3D=3D sizeof (float)) ? __fpclassifyf(x) \ > > - : (sizeof (x) =3D=3D sizeof (double)) ? __fpclassifyd(x) \ > > - : __fpclassifyl(x)) > > + __fp_type_select(x, __fpclassifyf, __fpclassifyd, > > __fpclassifyd) > > > > The last __fpclassifyd should be __fpclassifyl. > > > I see it has already been fixed. >=20 >=20 Obviously not really fixed, but even worse: if I use in C code (C99, using clang 3.3 on FreeBSD 10.0-CURRENT/amd64 revision 253287) isnan(x) where x is a "const double", I receive now the following error (which doesn't appear on previous versions): [...] Making all in scaling /bin/sh ../../libtool --tag=3DCC --mode=3Dcompile cc -DHAVE_CONFIG_H -I. -I../.. -I. -I../ -I/usr/local/include -O0 -march=3Dnative -g -pipe -DHAVE_INLINE -g -O2 -MT libscaling_la-scalingTransientCroft.lo -MD -MP -MF .deps/libscaling_la-scalingTransientCroft.Tpo -c -o libscaling_la-scalingTransientCroft.lo `test -f 'scalingTransientCroft.c' || echo './'`scalingTransientCroft.c libtool: compile: cc -DHAVE_CONFIG_H -I. -I../.. -I. -I../ -I/usr/local/include -O0 -march=3Dnative -g -pipe -DHAVE_INLINE -g -O2 -MT libscaling_la-scalingTransientCroft.lo -MD -MP -MF .deps/libscaling_la-scalingTransientCroft.Tpo -c scalingTransientCroft.c -o libscaling_la-scalingTransientCroft.o scalingTransientCroft.c:48:12: error: controlling expression type 'const double' not compatible with any generic association type if (isnan(Dsg) || isnan(Dsc)) ^~~ /usr/include/math.h:109:19: note: expanded from macro 'isnan' __fp_type_select(x, __inline_isnanf, __inline_isnan, __inline_isnanl) ^ /usr/include/math.h:86:49: note: expanded from macro '__fp_type_select' #define __fp_type_select(x, f, d, ld) _Generic((x),=20 [...] The variables in question (Dsg and Dsc) are of type "const double". --Sig_/ZSAD9CXLaxRHx01iUtdTl3B Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQEcBAEBAgAGBQJR4HmNAAoJEOgBcD7A/5N8l/QH/35RmvVTNDC6a4uuInnSk27p eCprNuBQBFJvRVOAsNk22JmwNwH3MaKoSCbWQ8kaek0FMZiIL8CqZnujst+ONi5j 4rS5x1YTNlZrgl2vA/k0kdXbxXBb9gU7vbxGPGhwV+URo+zF5Fxbp/bq5+DIU+qQ 1sBGwv3gKFXsDqAUJ+Fhb/8u7V8NtyLwJLHlqVCpMFYMopeChw/936tATSeZZKkj iCU71toRC8ErBpVGQGHzhLde7GfI4RFhCJMPCFp/Iv/87Dia5DeGNz3xk35BzodG CF7sXwAowQJbv6ff4NLy/EfCxI6b0rZOrUQ7M8MvxKMh0MTt9bsomftaAwDGFB0= =/XUd -----END PGP SIGNATURE----- --Sig_/ZSAD9CXLaxRHx01iUtdTl3B--