diff --git a/src/h.h b/src/h.h index eb3fced8..1fa5ebe6 100644 --- a/src/h.h +++ b/src/h.h @@ -578,12 +578,15 @@ static inline B inc(B x) { } static inline void decG(B x) { #if DEBUG - assert(isVal(x)); + assert(isVal(x) && v(x)->refc>0); #endif Value* vx = v(x); if(!--vx->refc) value_free(vx); } FORCE_INLINE void ptr_decT(Arr* x) { // assumes argument is an array and consists of non-heap-allocated elements + #if DEBUG + assert(x->refc>0); + #endif if (x->refc==1) TIv(x,freeT)((Value*) x); else x->refc--; }