From: Martin Quinson Date: Fri, 10 Mar 2023 18:48:33 +0000 (+0100) Subject: Try to avoid a segfault on assert message X-Git-Tag: v3.34~351 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3863ea3407b8209a66dded84e28001f24225682c Try to avoid a segfault on assert message This is an attempt to fix https://framagit.org/simgrid/simgrid/-/issues/118 --- diff --git a/src/kernel/lmm/maxmin.cpp b/src/kernel/lmm/maxmin.cpp index c72b948553..4a94887b09 100644 --- a/src/kernel/lmm/maxmin.cpp +++ b/src/kernel/lmm/maxmin.cpp @@ -221,8 +221,10 @@ template void MaxMin::maxmin_solve(CnstList& cnst_list) "Cannot saturate more a constraint that has" " no active element! You may want to change the work amount precision (--cfg=precision/work-amount:)" " because of possible rounding effects.\n\tFor the record, the usage of this constraint is %g while " - "the maxmin precision to which it is compared is %g.\n\tThe usage of the previous constraint is %g.", - cnst_light_tab[pos].cnst->usage_, sg_precision_workamount, cnst_light_tab[pos - 1].cnst->usage_); + "the maxmin precision to which it is compared is %g.\n\t%s%g.", + cnst_light_tab[pos].cnst->usage_, sg_precision_workamount, + (pos > 0 ? "The usage of the previous constraint is " : "There is no previous constraint. "), + (pos > 0 ? cnst_light_tab[pos - 1].cnst->usage_ : -1)); saturated_constraints_update(cnst_light_tab[pos].remaining_over_usage, pos, saturated_constraints, &min_usage); }