DCPROGS / HJCFIT

Full maximum likelihood fitting of a mechanism directly to the entire sequence of open and shut times, with exact missed events correction.
GNU General Public License v3.0
9 stars 4 forks source link

Fix clang segfault on OSX 10.11 with stack allocated eigen arrays #132

Closed jenshnielsen closed 8 years ago

jenshnielsen commented 8 years ago

Looks like a compiler bug. The clang segfaults when trying to move the RecursionInterface. More debugging reveals that this is due to the std::map<t_key, t_element>. Changing this and the matching iterator to be heap allocated also fixes the crash.

       // Checks for existence in cache.
       t_key const key(_i, _m, _l);
-      std::map<t_key, t_element>::const_iterator const i_found = coeff_map_.find(key);
+      std::map<t_key, t_rmatrix>::const_iterator const i_found = coeff_map_.find(key);
       if(i_found != coeff_map_.end()) return i_found->second;

       // Otherwise compute it from recursion
diff --git a/likelihood/exact_survivor.h b/likelihood/exact_survivor.h
index 4b238fd..d3b9297 100644
--- a/likelihood/exact_survivor.h
+++ b/likelihood/exact_survivor.h
@@ -153,7 +153,7 @@ namespace DCProgs {
       //! Key of the map where coefficient matrices are stored.
       typedef std::tuple<t_uint, t_uint, t_uint> t_key;
       //! Map where coefficients are stored.
-      std::map<t_key, t_element> coeff_map_;
+      std::map<t_key, t_rmatrix> coeff_map_;
       //! D matrices (See equation 3.16)
       std::vector<t_element> dvalues_;
       //! Eigenvalues of the transition rate matrix.