Boost C++ Libraries: Ticket #3100: boost::math::binomial_coefficient causes Aborted (core dumped) https://svn.boost.org/trac10/ticket/3100 <p> The following program: </p> <p> <em>--- #include &lt;boost/math/special_functions/binomial.hpp&gt; </em></p> <p> int main () { </p> <blockquote> <p> boost::math::binomial_coefficient&lt;int&gt;(6, 2); </p> </blockquote> <p> } <em>--- </em></p> <p> causes: </p> <p> $ ./a.out terminate called after throwing an instance of 'boost::exception_detail::clone_impl&lt;boost::exception_detail::error_info_injector&lt;boost::bad_lexical_cast&gt; &gt;' </p> <blockquote> <p> what(): bad lexical cast: source type value could not be interpreted as target </p> </blockquote> <p> Aborted (core dumped) </p> <p> gdb says: </p> <p> $ gdb ./a.out core GNU gdb 6.8-debian Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later &lt;<a class="ext-link" href="http://gnu.org/licenses/gpl.html"><span class="icon">​</span>http://gnu.org/licenses/gpl.html</a>&gt; This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i486-linux-gnu"... </p> <p> warning: Can't read pathname for load map: Input/output error. Reading symbols from /home/jtocancipa/tmp/boost/lib/libboost_math_c99-gcc42-mt-1_38.so.1.38.0...done. Loaded symbols for /home/jtocancipa/tmp/boost/lib/libboost_math_c99-gcc42-mt-1_38.so.1.38.0 Reading symbols from /usr/lib/libstdc++.so.6...done. Loaded symbols for /usr/lib/libstdc++.so.6 Reading symbols from /lib/tls/i686/cmov/libm.so.6...done. Loaded symbols for /lib/tls/i686/cmov/libm.so.6 Reading symbols from /lib/libgcc_s.so.1...done. Loaded symbols for /lib/libgcc_s.so.1 Reading symbols from /lib/tls/i686/cmov/libc.so.6...done. Loaded symbols for /lib/tls/i686/cmov/libc.so.6 Reading symbols from /lib/tls/i686/cmov/librt.so.1...done. Loaded symbols for /lib/tls/i686/cmov/librt.so.1 Reading symbols from /lib/tls/i686/cmov/libpthread.so.0...done. Loaded symbols for /lib/tls/i686/cmov/libpthread.so.0 Reading symbols from /lib/ld-linux.so.2...done. Loaded symbols for /lib/ld-linux.so.2 Core was generated by `./a.out'. Program terminated with signal 6, Aborted. [New process 22772] <a class="missing ticket">#0</a> 0xb7f53410 in <span class="underline">kernel_vsyscall () (gdb) bt 100 <a class="missing ticket">#0</a> 0xb7f53410 in </span>kernel_vsyscall () <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1" title="#1: Bugs: boost.build causes ftjam to segfault (closed: Wont Fix)">#1</a> 0xb7cd5085 in raise () from /lib/tls/i686/cmov/libc.so.6 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2" title="#2: Bugs: list::size should be const (closed: fixed)">#2</a> 0xb7cd6a01 in abort () from /lib/tls/i686/cmov/libc.so.6 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3" title="#3: Bugs: automatic conversion and overload proble (closed: fixed)">#3</a> 0xb7ee5480 in <span class="underline">gnu_cxx::</span>verbose_terminate_handler () from /usr/lib/libstdc++.so.6 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4" title="#4: Bugs: any_ptr in any library documentation? (closed: Fixed)">#4</a> 0xb7ee2d05 in ?? () from /usr/lib/libstdc++.so.6 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5" title="#5: Bugs: shared_ptr and self-owning objects (closed: Fixed)">#5</a> 0xb7ee2d42 in std::terminate () from /usr/lib/libstdc++.so.6 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6" title="#6: Bugs: tie in utility.hpp and tuple.hpp clash. (closed: Duplicate)">#6</a> 0xb7ee2e6a in <span class="underline">cxa_throw () from /usr/lib/libstdc++.so.6 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7" title="#7: Bugs: g++ 2.96 requires NO_STRINGSTREAM (closed: Fixed)">#7</a> 0x0805da35 in boost::throw_exception&lt;boost::bad_lexical_cast&gt; () <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8" title="#8: Bugs: prop in undirected graph + out_edges (closed: Works For Me)">#8</a> 0x0805db17 in boost::detail::lexical_cast&lt;int, char const*, false, char&gt; () <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9" title="#9: Bugs: config_info ambiguity error (closed: Invalid)">#9</a> 0x0805dd3e in boost::lexical_cast&lt;int, char <a class="changeset" href="https://svn.boost.org/trac10/changeset/11" title="Initial content for next-gen Boost website. ">[11]</a>&gt; () <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/10" title="#10: Bugs: allyourbase.jam file is bad. (closed: Out of Date)">#10</a> 0x0805edfe in boost::math::unchecked_factorial&lt;int&gt; () <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/11" title="#11: Bugs: why not using mt19937? (closed: Fixed)">#11</a> 0x08061d77 in boost::math::binomial_coefficient&lt;int, boost::math::policies::policy&lt;boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy&gt; &gt; () <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/12" title="#12: Bugs: Can't specify VertexPredicate (closed: Fixed)">#12</a> 0x08061ef5 in boost::math::binomial_coefficient&lt;int&gt; () <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/13" title="#13: Bugs: iterator_adapter and abstract classes (closed: Out of Date)">#13</a> 0x08050e35 in main () </span></p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3100 Trac 1.4.3 anonymous Wed, 27 May 2009 16:33:03 GMT attachment set https://svn.boost.org/trac10/ticket/3100 https://svn.boost.org/trac10/ticket/3100 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">foo.cpp</span> </li> </ul> Ticket John Maddock Wed, 27 May 2009 17:47:34 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3100#comment:1 https://svn.boost.org/trac10/ticket/3100#comment:1 <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">wontfix</span> </li> </ul> <p> This function, and the similar factorial functions are not intended to be used with integer types: doing so is generally speaking unsafe, because any non-trivial example will return a result too large to be represented in an integer type. </p> <p> I'll add a static-assertion to that effect so that in future this code doesn't compile. </p> <p> Regards, John Maddock. </p> Ticket