You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Eigen assertions from Stan code are always indicative of a bug (see #3075, most recently) but they lack any contextual information about where the assertion occurs. We can inject this ourselves using the Boost.Stacktrace library, which would make reports much easier to debug.
For example, this code seems to work on Linux:
#defineBOOST_STACKTRACE_USE_ADDR2LINE1
#include<stdexcept>
#include<iostream>
#include<boost/stacktrace.hpp>
#undef eigen_assert
#defineeigen_assert(x) \
if (!(x)) { std::cerr << boost::stacktrace::stacktrace() << std::endl;\
throw (std::runtime_error("Eigen assertion failed! Please report a bug to Stan")); }
This will report both the C++ traceback, and because it is a normal exception, the location in the Stan source file which triggered it.
Boost.Stacktrace does require some extra libraries, which are pre-installed on *Nix-like, but may not be on Windows, so we may want to add the above behind a STAN_DEBUG flag or similar.
Current Version:
v4.9.0
The text was updated successfully, but these errors were encountered:
Description
Eigen assertions from Stan code are always indicative of a bug (see #3075, most recently) but they lack any contextual information about where the assertion occurs. We can inject this ourselves using the Boost.Stacktrace library, which would make reports much easier to debug.
For example, this code seems to work on Linux:
This will report both the C++ traceback, and because it is a normal exception, the location in the Stan source file which triggered it.
Boost.Stacktrace does require some extra libraries, which are pre-installed on *Nix-like, but may not be on Windows, so we may want to add the above behind a
STAN_DEBUG
flag or similar.Current Version:
v4.9.0
The text was updated successfully, but these errors were encountered: