From owner-freebsd-current@FreeBSD.ORG Sun Jul 7 08:22:43 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A6A37D50 for ; Sun, 7 Jul 2013 08:22:43 +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 509331961 for ; Sun, 7 Jul 2013 08:22:42 +0000 (UTC) Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost1.zedat.fu-berlin.de (Exim 4.80.1) for freebsd-current@freebsd.org with esmtp (envelope-from ) id <1UvkEz-001O6X-KM>; Sun, 07 Jul 2013 10:22:41 +0200 Received: from g226181082.adsl.alicedsl.de ([92.226.181.82] helo=thor.walstatt.dyndns.org) by inpost2.zedat.fu-berlin.de (Exim 4.80.1) for freebsd-current@freebsd.org with esmtpsa (envelope-from ) id <1UvkEz-0033Hx-FB>; Sun, 07 Jul 2013 10:22:41 +0200 Date: Sun, 7 Jul 2013 10:22:40 +0200 From: "O. Hartmann" To: freebsd-current@freebsd.org Subject: Re: libc++: std::isinf() returns "int", is supposed to return boolvec_t Message-ID: <20130707102240.782e7db2@thor.walstatt.dyndns.org> In-Reply-To: <20130707101128.03579a41@thor.walstatt.dyndns.org> References: <20130707101128.03579a41@thor.walstatt.dyndns.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_/hIlUzN8C0llAFw1y2ykpaJJ"; protocol="application/pgp-signature" X-Originating-IP: 92.226.181.82 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2013 08:22:43 -0000 --Sig_/hIlUzN8C0llAFw1y2ykpaJJ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sun, 7 Jul 2013 10:11:28 +0200 "O. Hartmann" wrote: >=20 > Hello. >=20 > I try to compile a package of C++ software for FreeBSD with CLANG > which uses clang++. I have to use -stdlib=3Dlibc++ -std=3Dc++11. >=20 > I receive the following error and after consulting developers of the > code I was informed that libc++ routine "std::isinf()" should return > boolvec_t, but it returns obviously int. >=20 > Well, I'm not an expert, I take this for true and I'm inclinded to ask > here whether there is a bug I discover in the code I'm supposed to > compile or whether this is a bug in the FreeBSD's libc++ > implementation used. >=20 > The fault is as follows: >=20 > [...] >=20 > /usr/bin/clang++ -Xclang -ffake-address-space-map -std=3Dc++11 > -fno-exceptions -emit-llvm -ffp-contract=3Doff -stdlib=3Dlibc++ -c > -target amd64-portbld-freebsd10.0 -o > acosh.cc.bc ../vecmathlib/pocl/acosh.cc > -include ../../../include/x86_64/types.h In file included > from ../vecmathlib/pocl/acosh.cc:3: In file included > from ../vecmathlib/pocl/pocl-compat.h:8: In file included > from ../vecmathlib/pocl/../vecmathlib.h:89: ../vecmathlib/pocl/../vec_sse= _double1.h:451:38: > error: conversion from 'int' to 'boolvec_t' (aka 'boolvec size>') is ambiguous boolvec_t isinf() const { return std::isinf(v); } > size>^~~~~~~~~~~~~ ../vecmathlib/pocl/../vec_sse_double1.h:75:5: note: > size>candidate constructor boolvec(bvector_t x): v(x) {} > ^ > ../vecmathlib/pocl/../vec_sse_double1.h:76:5: note: candidate > constructor boolvec(bool a): v(a) {} > ^ > ../vecmathlib/pocl/../vec_sse_double1.h:461:14: error: conversion from > 'int' to 'boolvec_t' (aka 'boolvec') is ambiguous return > std::isnan(v); ^~~~~~~~~~~~~ > ../vecmathlib/pocl/../vec_sse_double1.h:75:5: note: candidate > constructor boolvec(bvector_t x): v(x) {} > ^ > ../vecmathlib/pocl/../vec_sse_double1.h:76:5: note: candidate > constructor boolvec(bool a): v(a) {} > ^ > In file included from ../vecmathlib/pocl/acos.cc:3: > In file included from ../vecmathlib/pocl/pocl-compat.h:8: > In file included from ../vecmathlib/pocl/../vecmathlib.h:89: > ../vecmathlib/pocl/../vec_sse_double1.h:451:38: error: conversion from > 'int' to 'boolvec_t' (aka 'boolvec') is ambiguous > boolvec_t isinf() const { return std::isinf(v); } ^~~~~~~~~~~~~ > ../vecmathlib/pocl/../vec_sse_double1.h:75:5: note: candidate > constructor boolvec(bvector_t x): v(x) {} > ^ > ../vecmathlib/pocl/../vec_sse_double1.h:76:5: note: candidate > constructor boolvec(bool a): v(a) {} > ^ > ../vecmathlib/pocl/../vec_sse_double1.h:461:14: error: conversion from > 'int' to 'boolvec_t' (aka 'boolvec') is ambiguous return > std::isnan(v); ^~~~~~~~~~~~~ > ../vecmathlib/pocl/../vec_sse_double1.h:75:5: note: candidate > constructor boolvec(bvector_t x): v(x) {} > ^ > ../vecmathlib/pocl/../vec_sse_double1.h:76:5: note: candidate > constructor boolvec(bool a): v(a) {} >=20 >=20 > Regards, >=20 > Oliver Sorry for the confusion. Well, C++11 standard says isnan() and fellows return bool, but somehow, it returns int - as I suspect. One of the codelines producing the error is (taken from POCLrc6: vec_sse_double1.h): [...] boolvec_t isfinite() const { return std::isfinite(v); } boolvec_t isinf() const { return std::isinf(v); } boolvec_t isnan() const { // This is wrong: // return _mm_ucomineq_sd(from_double(v), from_double(v)); // This works: // char r; // __asm__("ucomisd %[v],%[v]; setp %[r]": [r]"=3Dq"(r): [v]"x"(v)); // return boolvec_t::scalar_t(r); // This works as well: return std::isnan(v); } [...] --Sig_/hIlUzN8C0llAFw1y2ykpaJJ Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQEcBAEBAgAGBQJR2SVRAAoJEOgBcD7A/5N8sMMIANy2yCizTpuqqMKcy9MXYOQe txjavLsqJ0y/sLA4HQevqA2lyJwsMRCHtL873r0gKvSoVLEJZujaEVrvstmsdR2T f0B6wvxiFGvR1Qz2coV6SZ8LsKjTgK2c6wDEkc1PQqt6Qbx/7EJO1tF/NxqgDcW0 84xeygv2LtLqE6z98x7fcFZogAjtd2eK2OGAUz2cB4mt41rWomUFCTznR9Llb7JS Ejx+F88/HQqXMKWxTNW1Fjghytm5MzwL75qtn6j39iXQ0d38V/+NtVrcdCRKH2tO FwTZQxGQNLc30S7OD14T4UK/yMOBLr/KfrrPjErjUoG2RMYx7QiaTlcispb1N84= =wsNS -----END PGP SIGNATURE----- --Sig_/hIlUzN8C0llAFw1y2ykpaJJ--