libc++: std::isinf() returns "int", is supposed to return boolvec_t
O. Hartmann
ohartman at zedat.fu-berlin.de
Sun Jul 7 08:22:43 UTC 2013
On Sun, 7 Jul 2013 10:11:28 +0200
"O. Hartmann" <ohartman at zedat.fu-berlin.de> wrote:
>
> Hello.
>
> I try to compile a package of C++ software for FreeBSD with CLANG
> which uses clang++. I have to use -stdlib=libc++ -std=c++11.
>
> 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.
>
> 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.
>
> The fault is as follows:
>
> [...]
>
> /usr/bin/clang++ -Xclang -ffake-address-space-map -std=c++11
> -fno-exceptions -emit-llvm -ffp-contract=off -stdlib=libc++ -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<real_t,
> 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<real_t, size>') 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<real_t, size>') 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<real_t, size>') 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) {}
>
>
> Regards,
>
> 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]"=q"(r): [v]"x"(v));
// return boolvec_t::scalar_t(r);
// This works as well:
return std::isnan(v);
}
[...]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20130707/f3f634c9/attachment.sig>
More information about the freebsd-current
mailing list