From: Ivan Maidanski Date: Thu, 22 Dec 2016 22:00:28 +0000 (+0300) Subject: Eliminate 'array vs singleton' code defect in typed_test (gctest) X-Git-Tag: v8.0.0~969 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7eacc786662545d3e302d006ba09ca8a9a631b7b;p=gc Eliminate 'array vs singleton' code defect in typed_test (gctest) Taking address of bmX yields a singleton pointer but GC_make_descriptor expects an array (of words). * tests/test.c (typed_test): Define bm3, bm2, bm_large as 1-element arrays (instead of values of a primitive type), and remove "&" operator when passing them to GC_make_descriptor. --- diff --git a/tests/test.c b/tests/test.c index 7123bd12..8f6a0955 100644 --- a/tests/test.c +++ b/tests/test.c @@ -1084,18 +1084,18 @@ const GC_word bm_huge[320 / CPP_WORDSZ] = { void typed_test(void) { GC_word * old, * new; - GC_word bm3 = 0x3; - GC_word bm2 = 0x2; - GC_word bm_large = 0xf7ff7fff; - GC_descr d1 = GC_make_descriptor(&bm3, 2); - GC_descr d2 = GC_make_descriptor(&bm2, 2); - GC_descr d3 = GC_make_descriptor(&bm_large, 32); + GC_word bm3[1] = { 0x3 }; + GC_word bm2[1] = { 0x2 }; + GC_word bm_large[1] = { 0xf7ff7fff }; + GC_descr d1 = GC_make_descriptor(bm3, 2); + GC_descr d2 = GC_make_descriptor(bm2, 2); + GC_descr d3 = GC_make_descriptor(bm_large, 32); GC_descr d4 = GC_make_descriptor(bm_huge, 320); GC_word * x = (GC_word *)GC_malloc_explicitly_typed(2000, d4); int i; # ifndef LINT - (void)GC_make_descriptor(&bm_large, 32); + (void)GC_make_descriptor(bm_large, 32); # endif collectable_count++; if (GC_get_bit(bm_huge, 32) == 0 || GC_get_bit(bm_huge, 311) == 0