Boost C++ Libraries: Ticket #8333: [math] PGI 11.3 problems (sph_bessel.cpp, sph_bessel.cpp) https://svn.boost.org/trac10/ticket/8333 <p> Hi, </p> <p> Compilation of boost 1.53.0 with the PGI 11.3 compiler on RHEL5 fails for the following targets: </p> <ul><li>bin.v2/libs/math/build/pgi/release/threading-multi/sph_bessel.o </li><li>bin.v2/libs/math/build/pgi/release/threading-multi/sph_bessell.o </li></ul><p> Is this a known issue? I cannot seem to find it mentioned in the bugtracker. </p> <p> Thanks, </p> <p> Mark </p> <p> Error messages follow: </p> <pre class="wiki">pgi.compile.c++ bin.v2/libs/math/build/pgi/release/threading-multi/sph_bessel.o "./boost/math/special_functions/sinc.hpp", line 70: error: more than one instance of overloaded function "abs" matches the argument list: function "abs(double)" function "abs(int)" argument types are: (const long double) if (abs(x) &gt;= taylor_n_bound) ^ detected during: instantiation of "T boost::math::detail::sinc_pi_imp(T) [with T=long double]" at line 110 instantiation of "boost::math::tools::promote_args&lt;T, float, float, float, float, float&gt;::type boost::math::sinc_pi(T, const Policy &amp;) [with T=long double, Policy=c_policies::c_policy]" at line 154 of "./boost/math/special_functions/bessel.hpp" instantiation of "T boost::math::detail::sph_bessel_j_imp(unsigned int, T, const Policy &amp;) [with T=long double, Policy=c_policies::c_policy]" at line 394 of "./boost/math/special_functions/bessel.hpp" instantiation of "boost::math::detail::bessel_traits&lt;T, T, Policy&gt;::result_type boost::math::sph_bessel(unsigned int, T, const Policy &amp;) [with T=double, Policy=c_policies::c_policy]" at line 129 of "libs/math/build/../src/tr1/c_policy.hpp" instantiation of "boost::math::detail::bessel_traits&lt;T, T, c_policies::c_policy&gt;::result_type c_policies::sph_bessel(unsigned int, T) [with T=double]" at line 16 of "libs/math/build/../src/tr1/sph_bessel.cpp" "./boost/math/special_functions/sinc.hpp", line 79: error: more than one instance of overloaded function "abs" matches the argument list: function "abs(double)" function "abs(int)" argument types are: (const long double) if (abs(x) &gt;= taylor_0_bound) ^ detected during: instantiation of "T boost::math::detail::sinc_pi_imp(T) [with T=long double]" at line 110 instantiation of "boost::math::tools::promote_args&lt;T, float, float, float, float, float&gt;::type boost::math::sinc_pi(T, const Policy &amp;) [with T=long double, Policy=c_policies::c_policy]" at line 154 of "./boost/math/special_functions/bessel.hpp" instantiation of "T boost::math::detail::sph_bessel_j_imp(unsigned int, T, const Policy &amp;) [with T=long double, Policy=c_policies::c_policy]" at line 394 of "./boost/math/special_functions/bessel.hpp" instantiation of "boost::math::detail::bessel_traits&lt;T, T, Policy&gt;::result_type boost::math::sph_bessel(unsigned int, T, const Policy &amp;) [with T=double, Policy=c_policies::c_policy]" at line 129 of "libs/math/build/../src/tr1/c_policy.hpp" instantiation of "boost::math::detail::bessel_traits&lt;T, T, c_policies::c_policy&gt;::result_type c_policies::sph_bessel(unsigned int, T) [with T=double]" at line 16 of "libs/math/build/../src/tr1/sph_bessel.cpp" "./boost/math/special_functions/sinc.hpp", line 86: error: more than one instance of overloaded function "abs" matches the argument list: function "abs(double)" function "abs(int)" argument types are: (const long double) if (abs(x) &gt;= taylor_2_bound) ^ detected during: instantiation of "T boost::math::detail::sinc_pi_imp(T) [with T=long double]" at line 110 instantiation of "boost::math::tools::promote_args&lt;T, float, float, float, float, float&gt;::type boost::math::sinc_pi(T, const Policy &amp;) [with T=long double, Policy=c_policies::c_policy]" at line 154 of "./boost/math/special_functions/bessel.hpp" instantiation of "T boost::math::detail::sph_bessel_j_imp(unsigned int, T, const Policy &amp;) [with T=long double, Policy=c_policies::c_policy]" at line 394 of "./boost/math/special_functions/bessel.hpp" instantiation of "boost::math::detail::bessel_traits&lt;T, T, Policy&gt;::result_type boost::math::sph_bessel(unsigned int, T, const Policy &amp;) [with T=double, Policy=c_policies::c_policy]" at line 129 of "libs/math/build/../src/tr1/c_policy.hpp" instantiation of "boost::math::detail::bessel_traits&lt;T, T, c_policies::c_policy&gt;::result_type c_policies::sph_bessel(unsigned int, T) [with T=double]" at line 16 of "libs/math/build/../src/tr1/sph_bessel.cpp" 3 errors detected in the compilation of "libs/math/build/../src/tr1/sph_bessel.cpp". "pgCC" -Kieee -fpic -fPIC -fast -Mx,8,0x10000000 -Minform=warn -DBOOST_ALL_NO_LIB=1 -DBOOST_MATH_TR1_DYN_LINK=1 -DNDEBUG -D__need_IOV_MAX - I"." -I"libs/math/src/tr1" -c -o "bin.v2/libs/math/build/pgi/release/threading-multi/sph_bessel.o" "libs/math/build/../src/tr1/sph_bessel.cpp" pgi.compile.c++ bin.v2/libs/math/build/pgi/release/threading-multi/sph_bessell.o "./boost/math/special_functions/sinc.hpp", line 70: error: more than one instance of overloaded function "abs" matches the argument list: function "abs(double)" function "abs(int)" argument types are: (const long double) if (abs(x) &gt;= taylor_n_bound) ^ detected during: instantiation of "T boost::math::detail::sinc_pi_imp(T) [with T=long double]" at line 110 instantiation of "boost::math::tools::promote_args&lt;T, float, float, float, float, float&gt;::type boost::math::sinc_pi(T, const Policy &amp;) [with T=long double, Policy=c_policies::c_policy]" at line 154 of "./boost/math/special_functions/bessel.hpp" instantiation of "T boost::math::detail::sph_bessel_j_imp(unsigned int, T, const Policy &amp;) [with T=long double, Policy=c_policies::c_policy]" at line 394 of "./boost/math/special_functions/bessel.hpp" instantiation of "boost::math::detail::bessel_traits&lt;T, T, Policy&gt;::result_type boost::math::sph_bessel(unsigned int, T, const Policy &amp;) [with T=long double, Policy=c_policies::c_policy]" at line 129 of "libs/math/build/../src/tr1/c_policy.hpp" instantiation of "boost::math::detail::bessel_traits&lt;T, T, c_policies::c_policy&gt;::result_type c_policies::sph_bessel(unsigned int, T) [with T=long double]" at line 16 of "libs/math/build/../src/tr1/sph_bessell.cpp" "./boost/math/special_functions/sinc.hpp", line 79: error: more than one instance of overloaded function "abs" matches the argument list: function "abs(double)" function "abs(int)" argument types are: (const long double) if (abs(x) &gt;= taylor_0_bound) ^ detected during: instantiation of "T boost::math::detail::sinc_pi_imp(T) [with T=long double]" at line 110 instantiation of "boost::math::tools::promote_args&lt;T, float, float, float, float, float&gt;::type boost::math::sinc_pi(T, const Policy &amp;) [with T=long double, Policy=c_policies::c_policy]" at line 154 of "./boost/math/special_functions/bessel.hpp" instantiation of "T boost::math::detail::sph_bessel_j_imp(unsigned int, T, const Policy &amp;) [with T=long double, Policy=c_policies::c_policy]" at line 394 of "./boost/math/special_functions/bessel.hpp" instantiation of "boost::math::detail::bessel_traits&lt;T, T, Policy&gt;::result_type boost::math::sph_bessel(unsigned int, T, const Policy &amp;) [with T=long double, Policy=c_policies::c_policy]" at line 129 of "libs/math/build/../src/tr1/c_policy.hpp" instantiation of "boost::math::detail::bessel_traits&lt;T, T, c_policies::c_policy&gt;::result_type c_policies::sph_bessel(unsigned int, T) [with T=long double]" at line 16 of "libs/math/build/../src/tr1/sph_bessell.cpp" "./boost/math/special_functions/sinc.hpp", line 86: error: more than one instance of overloaded function "abs" matches the argument list: function "abs(double)" function "abs(int)" argument types are: (const long double) if (abs(x) &gt;= taylor_2_bound) ^ detected during: instantiation of "T boost::math::detail::sinc_pi_imp(T) [with T=long double]" at line 110 instantiation of "boost::math::tools::promote_args&lt;T, float, float, float, float, float&gt;::type boost::math::sinc_pi(T, const Policy &amp;) [with T=long double, Policy=c_policies::c_policy]" at line 154 of "./boost/math/special_functions/bessel.hpp" instantiation of "T boost::math::detail::sph_bessel_j_imp(unsigned int, T, const Policy &amp;) [with T=long double, Policy=c_policies::c_policy]" at line 394 of "./boost/math/special_functions/bessel.hpp" instantiation of "boost::math::detail::bessel_traits&lt;T, T, Policy&gt;::result_type boost::math::sph_bessel(unsigned int, T, const Policy &amp;) [with T=long double, Policy=c_policies::c_policy]" at line 129 of "libs/math/build/../src/tr1/c_policy.hpp" instantiation of "boost::math::detail::bessel_traits&lt;T, T, c_policies::c_policy&gt;::result_type c_policies::sph_bessel(unsigned int, T) [with T=long double]" at line 16 of "libs/math/build/../src/tr1/sph_bessell.cpp" 3 errors detected in the compilation of "libs/math/build/../src/tr1/sph_bessell.cpp". "pgCC" -Kieee -fpic -fPIC -fast -Mx,8,0x10000000 -Minform=warn -DBOOST_ALL_NO_LIB=1 -DBOOST_MATH_TR1_DYN_LINK=1 -DNDEBUG -D__need_IOV_MAX - I"." -I"libs/math/src/tr1" -c -o "bin.v2/libs/math/build/pgi/release/threading-multi/sph_bessell.o" "libs/math/build/../src/tr1/sph_bessell.cpp " </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8333 Trac 1.4.3 John Maddock Mon, 25 Mar 2013 17:09:18 GMT <link>https://svn.boost.org/trac10/ticket/8333#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8333#comment:1</guid> <description> <p> No it's not a known issue, is there no std::abs(long double) overload on that platform? </p> <p> I could change it to use std::fabs if that helps? </p> </description> <category>Ticket</category> </item> <item> <author>Mark Dixon <m.c.dixon@…></author> <pubDate>Tue, 26 Mar 2013 08:58:11 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8333#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8333#comment:2</guid> <description> <p> Hi, </p> <p> I warn you, I've not done any C++ before, but I'm not sure that's the problem - the following test compiles and prints out 3.14: </p> <pre class="wiki">#include &lt;cmath&gt; #include &lt;iostream&gt; int main() { long double value = -3.14; cout &lt;&lt; "Absolute: " &lt;&lt; std::abs(value) &lt;&lt; endl; } </pre><pre class="wiki">$ pgCC -o test2 test2.cpp $ ./test2 Absolute: 3.14 </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Tue, 26 Mar 2013 13:32:18 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8333#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8333#comment:3</guid> <description> <p> What happens if you add #include &lt;cstdlib&gt; to your test case? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Tue, 26 Mar 2013 13:38:45 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8333#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8333#comment:4</guid> <description> <blockquote class="citation"> <p> What happens if you add #include &lt;cstdlib&gt; to your test case? </p> </blockquote> <p> That was going to be my next question as well, add </p> <pre class="wiki">#include &lt;cstdlib&gt; </pre><p> To the very top of libs/math/src/tr1/sph_bessel.cpp </p> </description> <category>Ticket</category> </item> <item> <author>Mark Dixon <m.c.dixon@…></author> <pubDate>Tue, 26 Mar 2013 14:58:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8333#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8333#comment:5</guid> <description> <p> Thank you both for the suggestions, but I'm afraid there's no change:- </p> <p> My test case still works and the boost build still fails (with the same message - except it's now complaining about line 17 of sph_bessel.cpp instead of 16) </p> <p> Mark </p> </description> <category>Ticket</category> </item> <item> <author>alan.r.wild@…</author> <pubDate>Wed, 03 Apr 2013 03:06:50 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8333#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8333#comment:6</guid> <description> <p> I'm also seeing this error on PGI 12.2 and PGI 12.5 on SuSE 11 (CLE4, specifically). Same system compiling with GCC (4.6.1, 4.6.2, 4.7.0, &amp; 4.7.1), Intel 11.1 or Cray's compiler (8.0 and 8.1) aren't showing this error. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 03 Apr 2013 08:22:40 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8333#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8333#comment:7</guid> <description> <p> Are you able to do a quick grep and find out which header defines std::abs(long double) on that platform as from the comments above neither &lt;cmath&gt; nor &lt;cstdlib&gt; appear to be defining it? </p> <p> Thanks, John. </p> </description> <category>Ticket</category> </item> <item> <author>Mark Dixon <m.c.dixon@…></author> <pubDate>Wed, 03 Apr 2013 11:55:50 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8333#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8333#comment:8</guid> <description> <p> For PGI 11.3, it seems to be in: </p> <pre class="wiki">${PGI_HOME}/include/CC/stl/_cmath.h </pre><p> Which is included by the following headers: </p> <pre class="wiki">${PGI_HOME}/include/CC/cmath ${PGI_HOME}/include/CC/stl/_valarray.h ${PGI_HOME}/include/CC/stl/_complex.h </pre><p> So it "should" be included. </p> <p> Sticking the following definition: </p> <pre class="wiki">long double abs (long double __x) { return __x; } </pre><p> At the very top of sph_bessel.cpp results in the following compile error: </p> <pre class="wiki">"/apps/compilers/pgi/11.3/1/default/linux86-64/11.3/include/CC/stl/_cmath.h", line 208: error: function "std::abs(long double)" conflicts with using-declaration of function "abs(long double)" inline long double abs (long double __x) { return _STLP_DO_ABS(long double)((double)__x); } ^ "./boost/math/special_functions/fpclassify.hpp", line 85: error: using-declaration of function "abs(long double)" conflicts with function "std::abs(long double)" (declared at line 208 of "/apps/compilers/pgi/11.3/1/default/linux86-64/11.3/include/CC/stl/_c math.h") namespace std{ using ::abs; using ::fabs; } ^ 2 errors detected in the compilation of "libs/math/src/tr1/sph_bessel.cpp". </pre><p> So it would appear that it is being included. </p> <p> Alternatively, if I alter sph_bessel.cpp to read: </p> <pre class="wiki">// Copyright John Maddock 2008. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // # include &lt;pch.hpp&gt; #ifndef BOOST_MATH_TR1_SOURCE # define BOOST_MATH_TR1_SOURCE #endif #include &lt;boost/math/tr1.hpp&gt; #include &lt;boost/math/special_functions/bessel.hpp&gt; #include "c_policy.hpp" extern "C" double BOOST_MATH_TR1_DECL boost_sph_bessel BOOST_PREVENT_MACRO_SUBSTITUTION(unsigned n, double x) BOOST_MATH_C99_THROW_SPEC { long double val = 3.14; std::abs(val); return c_policies::sph_bessel BOOST_PREVENT_MACRO_SUBSTITUTION(n, x); } </pre><p> I get the 3 compile errors originally reported, but no new ones. sph_bessel.cpp clearly knows about the long double abs definition. </p> <p> Presumably the problem is deep in the include files? </p> <p> Thanks, </p> <p> Mark </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 03 Apr 2013 14:16:30 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8333#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8333#comment:9</guid> <description> <p> OK, next try: can you replace in boost/math/special_functions/sinc.hpp, from line 64 </p> <pre class="wiki">#if defined(BOOST_NO_STDC_NAMESPACE) &amp;&amp; !defined(__SUNPRO_CC) using ::abs; using ::sin; using ::sqrt; #else /* BOOST_NO_STDC_NAMESPACE */ using ::std::abs; using ::std::sin; using ::std::sqrt; #endif /* BOOST_NO_STDC_NAMESPACE */ </pre><p> with simply </p> <pre class="wiki">BOOST_MATH_STD_USING </pre><p> And see if that kills some of the errors? </p> </description> <category>Ticket</category> </item> <item> <author>Mark Dixon <m.c.dixon@…></author> <pubDate>Wed, 03 Apr 2013 14:42:45 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8333#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8333#comment:10</guid> <description> <p> Nice one - library "math" now builds with no compiler errors at all :) </p> <p> Thanks, </p> <p> Mark </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Wed, 03 Apr 2013 18:06:28 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/8333#comment:11 https://svn.boost.org/trac10/ticket/8333#comment:11 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Fixed in Trunk. </p> Ticket John Maddock Sat, 28 Sep 2013 16:19:56 GMT <link>https://svn.boost.org/trac10/ticket/8333#comment:12 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8333#comment:12</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/85987" title="Merge accumulated patches from Trunk. Refs #8384, Refs #8855, refs ...">[85987]</a>) Merge accumulated patches from Trunk. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8384" title="#8384: Feature Requests: Make shared_ptr movable (closed: invalid)">#8384</a>, Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8855" title="#8855: Bugs: [math] GCC 4.8+ warns unused local typedef... (closed: fixed)">#8855</a>, refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9107" title="#9107: Bugs: unused parameter warning in fraction with clang (closed: fixed)">#9107</a>, refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9109" title="#9109: Bugs: Warning in bessel with -Wshadow (closed: fixed)">#9109</a>, refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8333" title="#8333: Bugs: [math] PGI 11.3 problems (sph_bessel.cpp, sph_bessel.cpp) (closed: fixed)">#8333</a>, refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8621" title="#8621: Bugs: erf function gives wrong results with pgcpp - PGI 10.4 (closed: fixed)">#8621</a>, refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8732" title="#8732: Bugs: Need to protect calls against C99 math macro expansion (closed: fixed)">#8732</a>, refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8733" title="#8733: Feature Requests: Testing for unprotected references to C99 math macros (closed: fixed)">#8733</a>, refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8837" title="#8837: Bugs: boost::math::students_t quantile() fails for huge degrees of freedom (closed: fixed)">#8837</a>, refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8940" title="#8940: Bugs: Argument promotion fails dependent libs on platforms not supporting ... (closed: fixed)">#8940</a>, refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9042" title="#9042: Bugs: boost::math, cdf(complement(normal_distribution&lt;&gt;(...)) fails to catch ... (closed: fixed)">#9042</a>, refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9087" title="#9087: Support Requests: [boost math] error: no operator &#34;=&#34; matches these operands in ... (closed: fixed)">#9087</a>, refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9104" title="#9104: Bugs: boost::math::ellint_2 bug in x86_64 double precision (closed: fixed)">#9104</a>, refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9126" title="#9126: Bugs: Logistic distribution pdf() and cdf(complement()) fail to catch ... (closed: fixed)">#9126</a>. </p> </description> <category>Ticket</category> </item> </channel> </rss>