From 0955e008a80ca01988e5f6d4fa8bb7646f4262f4 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Thu, 26 Aug 2010 18:53:19 -0300 Subject: [PATCH] Check the sentinel invariant in release builds too When building a release, the sentinel invariant isn't checked, even if the "sentinel" option is used. This patches checks the invariant always when the option is activated, abort()ing the program if the invariant fails. --- rt/gc/cdgc/gc.d | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rt/gc/cdgc/gc.d b/rt/gc/cdgc/gc.d index 78f673c..1afe5a0 100644 --- a/rt/gc/cdgc/gc.d +++ b/rt/gc/cdgc/gc.d @@ -2093,8 +2093,9 @@ void sentinel_init(void *p, size_t size) void sentinel_Invariant(void *p) { - assert(*sentinel_pre(p) == SENTINEL_PRE); - assert(*sentinel_post(p) == SENTINEL_POST); + if (*sentinel_pre(p) != SENTINEL_PRE || + *sentinel_post(p) != SENTINEL_POST) + cstdlib.abort(); } -- 2.43.0