[Boost-bugs] [Boost C++ Libraries] #10005: erf_inv_initializer crashes under valgrind

Subject: [Boost-bugs] [Boost C++ Libraries] #10005: erf_inv_initializer crashes under valgrind
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-05-04 00:08:46


#10005: erf_inv_initializer crashes under valgrind
--------------------------------------+-------------------------
 Reporter: Marcin Wojdyr <wojdyr@…> | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: math
  Version: Boost 1.54.0 | Severity: Problem
 Keywords: |
--------------------------------------+-------------------------
 It was reported before on the mailing list:
 http://lists.boost.org/boost-users/2012/08/75711.php
 and I assume it's because valgrind doesn't support long doubles:
 https://bugs.kde.org/show_bug.cgi?id=197915

 Somehow erfc_inv is called in this place and the argument is then found to
 be 0:

 {{{
 #!cpp
          // Some compilers choke on constants that would underflow, even
 in code that isn't instantiated
          // so try and filter these cases out in the preprocessor:
 #if LDBL_MAX_10_EXP >= 800
          if(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-800)) != 0)
 boost::math::erfc_inv(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64,
 1e-800)), Policy());

 }}}

 So an exception is thrown during initialization.
 While it may not be a bug, valgrind is extremely useful and it would be
 nice to have a workaround.

 I don't understand why erf_inv and erfc_inv are called with these
 arguments in `erf_inv_initializer<>::init::do_init()`, so I'm not sure
 what workaround is safe.

 Here is a full traceback:
 {{{
 #0 0x00000036fb435c39 in __GI_raise (sig=sig_at_entry=6)
     at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
 #1 0x00000036fb437348 in __GI_abort () at abort.c:89
 #2 0x00000036ff860f85 in __gnu_cxx::__verbose_terminate_handler ()
     at ../../../../libstdc++-v3/libsupc++/vterminate.cc:95
 #3 0x00000036ff85eee6 in __cxxabiv1::__terminate (handler=<optimized
 out>)
     at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:38
 #4 0x00000036ff85ef13 in std::terminate ()
     at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:48
 #5 0x00000036ff85f13f in __cxxabiv1::__cxa_throw (obj=0x526e490,
     tinfo=<optimized out>, dest=<optimized out>)
     at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:84
 #6 0x0000000004cb1541 in boost::throw_exception<std::overflow_error>
 (e=...)
     at /usr/include/boost/throw_exception.hpp:67
 #7 0x0000000004cb7f28 in
 boost::math::policies::detail::raise_error<std::overflow_error, long
 double> (
     function=0x4d2d338 "boost::math::erfc_inv<%1%>(%1%, %1%)",
     message=0x4d1bf8e "Overflow Error")
     at /usr/include/boost/math/policies/error_handling.hpp:95
 #8 0x0000000004cb7f98 in
 boost::math::policies::detail::raise_overflow_error<long double>
 (function=<optimized out>, message=<optimized out>)
     at /usr/include/boost/math/policies/error_handling.hpp:211
 #9 0x0000000004cdf17e in raise_overflow_error<long double,
 boost::math::policies::policy<boost::math::policies::promote_float<false>,
 boost::math::policies::promote_double<false>,
 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> > (message=0x0,
     function=<optimized out>)
     at /usr/include/boost/math/policies/error_handling.hpp:515
 #10 boost::math::erfc_inv<long double,
 boost::math::policies::policy<boost::math::policies::promote_float<false>,
 boost::math::policies::promote_double<false>,
 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> > (z=0, z_at_entry=0, pol=...)
     at /usr/include/boost/math/special_functions/detail/erf_inv.hpp:383
 #11 0x0000000004cdfaae in boost::math::detail::erf_inv_initializer<long
 double,
 boost::math::policies::policy<boost::math::policies::promote_float<false>,
 boost::math::policies::promote_double<false>,
 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> >::init::do_init () at
 /usr/include/boost/math/special_functions/detail/erf_inv.hpp:347
 #12 0x0000000004cda34b in init (this=<optimized out>)
     at /usr/include/boost/math/special_functions/detail/erf_inv.hpp:332
 #13 __static_initialization_and_destruction_0 (
     __initialize_p=__initialize_p_at_entry=1,
 __priority=__priority_at_entry=65535)
     at /usr/include/boost/math/special_functions/detail/erf_inv.hpp:367
 #14 0x0000000004cda463 in _GLOBAL__sub_I_fit.cpp(void) ()
     at ../../fityk/fit.cpp:643
 #15 0x00000036fb00f2ea in call_init (l=<optimized out>, argc=argc_at_entry=1,
     argv=argv_at_entry=0xffefffc48, env=env_at_entry=0xffefffc58) at dl-
 init.c:82
 #16 0x00000036fb00f3d3 in call_init (env=<optimized out>,
     argv=<optimized out>, argc=<optimized out>, l=<optimized out>)
     at dl-init.c:34
 #17 _dl_init (main_map=0x36fb221168, argc=1, argv=0xffefffc48,
 env=0xffefffc58)
     at dl-init.c:130
 #18 0x00000036fb00122a in _dl_start_user () from /lib64/ld-
 linux-x86-64.so.2
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10005>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC