From: Ivan Maidanski Date: Sun, 18 Nov 2012 08:32:34 +0000 (+0400) Subject: Enable huge_test for Win64 (and LLP64 target) X-Git-Tag: gc7_6_0~199^2~23 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dcb1c05a9cd550c5d6477375eca7f9dfe4fc8988;p=gc Enable huge_test for Win64 (and LLP64 target) * tests/huge_test.c (GC_WORD_MAX): New macro * tests/huge_test.c (main): Do not check for long has the same size as pointer; use unsigned GC_WORD_MAX instead of LONG_MAX; use NULL instead of 0 for pointers. Conflicts: tests/huge_test.c --- diff --git a/tests/huge_test.c b/tests/huge_test.c index bde9836d..d1d71630 100644 --- a/tests/huge_test.c +++ b/tests/huge_test.c @@ -19,8 +19,11 @@ * expected manner. */ +#define GC_WORD_MAX (((GC_word)-1) >> 1) + int main(void) { + void *r; GC_INIT(); GC_set_max_heap_size(100*1024*1024); @@ -28,25 +31,23 @@ int main(void) /* That's OK. We test this corner case mostly to make sure that */ /* it fails predictably. */ GC_expand_hp(1024*1024*5); - if (sizeof(long) == sizeof(void *)) { - void *r = GC_MALLOC(LONG_MAX-1024); - if (0 != r) { - fprintf(stderr, - "Size LONG_MAX-1024 allocation unexpectedly succeeded\n"); - exit(1); - } - r = GC_MALLOC(LONG_MAX); - if (0 != r) { - fprintf(stderr, - "Size LONG_MAX allocation unexpectedly succeeded\n"); - exit(1); - } - r = GC_MALLOC((size_t)LONG_MAX + 1024); - if (0 != r) { - fprintf(stderr, - "Size LONG_MAX+1024 allocation unexpectedly succeeded\n"); - exit(1); - } + r = GC_MALLOC(GC_WORD_MAX - 1024); + if (NULL != r) { + fprintf(stderr, + "Size GC_WORD_MAX-1024 allocation unexpectedly succeeded\n"); + exit(1); + } + r = GC_MALLOC(GC_WORD_MAX); + if (NULL != r) { + fprintf(stderr, + "Size GC_WORD_MAX allocation unexpectedly succeeded\n"); + exit(1); + } + r = GC_MALLOC(GC_WORD_MAX + 1024); + if (NULL != r) { + fprintf(stderr, + "Size GC_WORD_MAX+1024 allocation unexpectedly succeeded\n"); + exit(1); } return 0; }