From: Ivan Maidanski Date: Wed, 27 Sep 2017 21:52:40 +0000 (+0300) Subject: Fix missing [un]collectable_count increments in gctest X-Git-Tag: v7.6.2~67 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9c792cd89132163601b09b5930c0b4a06022d07c;p=gc Fix missing [un]collectable_count increments in gctest * tests/test.c [!DBG_HDRS_ALL] (run_one_test): Increment uncollectable_count instead of collectable_count (for GC_malloc_uncollectable(0)). * tests/test.c [!DBG_HDRS_ALL] (run_one_test): Add missing increments of collectable_count for GC_malloc(8) and GC_malloc(17). * tests/test.c (run_one_test): Add missing increment of collectable_count for (void)GC_MALLOC(0). --- diff --git a/tests/test.c b/tests/test.c index 6d2378a1..c74fdd95 100644 --- a/tests/test.c +++ b/tests/test.c @@ -1296,7 +1296,7 @@ void run_one_test(void) (unsigned long)GC_size(GC_malloc(0))); FAIL; } - collectable_count += 1; + uncollectable_count++; if (GC_size(GC_malloc_uncollectable(0)) != MIN_WORDS * sizeof(GC_word)) { GC_printf("GC_malloc_uncollectable(0) failed\n"); FAIL; @@ -1344,6 +1344,7 @@ void run_one_test(void) } z = GC_malloc(8); CHECK_OUT_OF_MEMORY(z); + collectable_count++; GC_PTR_STORE(z, x); if (*z != x) { GC_printf("GC_PTR_STORE failed: %p != %p\n", (void *)(*z), (void *)x); @@ -1369,6 +1370,7 @@ void run_one_test(void) size_t i; (void)GC_malloc(17); + collectable_count++; for (i = sizeof(GC_word); i < 512; i *= 2) { GC_word result = (GC_word) GC_memalign(i, 17); if (result % i != 0 || result == 0 || *(int *)result != 0) FAIL; @@ -1402,6 +1404,7 @@ void run_one_test(void) size_t i; for (i = 0; i < 10000; ++i) { (void)GC_MALLOC(0); + collectable_count++; GC_FREE(GC_MALLOC(0)); (void)GC_MALLOC_ATOMIC(0); GC_FREE(GC_MALLOC_ATOMIC(0));