summaryrefslogtreecommitdiff
path: root/dbg_mlc.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2012-10-19 08:58:46 +0400
committerIvan Maidanski <ivmai@mail.ru>2012-10-19 16:59:36 +0400
commit0d667d207ca6cc96316e7d8ed896b222c41d3137 (patch)
treec291f00425e840ef4ec1093a9ada8420605cb1e7 /dbg_mlc.c
parent8445475ead3ed546b5ebabf00ce71d1b4fbef8db (diff)
downloadbdwgc-0d667d207ca6cc96316e7d8ed896b222c41d3137.tar.gz
Check GC_base result in GC_print_all_smashed_proc
* dbg_mlc.c (GC_print_all_smashed_proc): Add a code for a LINT-like (static code analysis) tool to instruct it that GC_base is invoked only with valid GC_smashed[] elements (so its result passed to GC_print_smashed_obj is non-NULL).
Diffstat (limited to 'dbg_mlc.c')
-rw-r--r--dbg_mlc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/dbg_mlc.c b/dbg_mlc.c
index 5229677d..d98195bb 100644
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
@@ -918,8 +918,12 @@ STATIC void GC_print_all_smashed_proc(void)
if (GC_n_smashed == 0) return;
GC_err_printf("GC_check_heap_block: found smashed heap objects:\n");
for (i = 0; i < GC_n_smashed; ++i) {
- GC_print_smashed_obj("", (ptr_t)GC_base(GC_smashed[i]) + sizeof(oh),
- GC_smashed[i]);
+ ptr_t base = (ptr_t)GC_base(GC_smashed[i]);
+
+# ifdef LINT2
+ if (!base) ABORT("Invalid GC_smashed element");
+# endif
+ GC_print_smashed_obj("", base + sizeof(oh), GC_smashed[i]);
GC_smashed[i] = 0;
}
GC_n_smashed = 0;