diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2012-10-19 08:58:46 +0400 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2012-10-19 16:59:36 +0400 |
commit | 0d667d207ca6cc96316e7d8ed896b222c41d3137 (patch) | |
tree | c291f00425e840ef4ec1093a9ada8420605cb1e7 /dbg_mlc.c | |
parent | 8445475ead3ed546b5ebabf00ce71d1b4fbef8db (diff) | |
download | bdwgc-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.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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; |