Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jul 2013 23:47:49 +0200
From:      "O. Hartmann" <ohartman@zedat.fu-berlin.de>
To:        Scot Hetzel <swhetzel@gmail.com>
Cc:        David Chisnall <theraven@freebsd.org>, "freebsd-toolchain@FreeBSD.org" <freebsd-toolchain@freebsd.org>, Garrett Wollman <wollman@csail.mit.edu>, FreeBSD CURRENT <freebsd-current@freebsd.org>, Bruce Evans <brde@optusnet.com.au>, Tijl Coosemans <tijl@freebsd.org>, "freebsd-standards@FreeBSD.org" <freebsd-standards@freebsd.org>
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: <CACdU%2Bf-LKsHsPayUYAT-cip91O=CfQg2aJ1BKC5PRd6G9Kf28w@mail.gmail.com>
References:  <20130710155809.0f589c22@thor.walstatt.dyndns.org> <CD51F125-AE9E-4461-916D-CF583002B47D@FreeBSD.org> <20130710183315.725dfde0@thor.walstatt.dyndns.org> <C8C94CF2-7D5A-471B-AD63-8E961AED6274@FreeBSD.org> <20130710203200.5359fd18@thor.walstatt.dyndns.org> <51DDC04B.6040209@FreeBSD.org> <20957.49978.73666.392417@khavrinen.csail.mit.edu> <20130711130043.R920@besplex.bde.org> <FD768A6B-8B72-44A1-BC1C-14FF44CB4643@FreeBSD.org> <20130711202908.L84170@besplex.bde.org> <C00DFA94-6182-4334-9C90-8012E576E475@FreeBSD.org> <CACdU%2Bf9RmwxSiMEjOwSXHtnDwKk4xY8fmA3aBE5mzrVUkrc1Nw@mail.gmail.com> <CACdU%2Bf-LKsHsPayUYAT-cip91O=CfQg2aJ1BKC5PRd6G9Kf28w@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--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 <swhetzel@gmail.com> wrote:

> On Fri, Jul 12, 2013 at 11:16 AM, Scot Hetzel <swhetzel@gmail.com>
> wrote:
> > On Thu, Jul 11, 2013 at 9:33 AM, David Chisnall
> > <theraven@freebsd.org> wrote:
> >> On 11 Jul 2013, at 13:11, Bruce Evans <brde@optusnet.com.au> 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130712234749.5afa3c9b>