]> granicus.if.org Git - gc/commitdiff
Enable huge_test for Win64 (and LLP64 target)
authorIvan Maidanski <ivmai@mail.ru>
Sun, 18 Nov 2012 08:32:34 +0000 (12:32 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 11 May 2015 15:57:16 +0000 (18:57 +0300)
* 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

tests/huge_test.c

index bde9836d5a8c48c02f9c68c925932739cdd1e255..d1d71630b0fa91b313a6d1091e5691cae41f099c 100644 (file)
  * 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;
 }