From b2764a02bab80581e802ab1406618eb9eb2b88f0 Mon Sep 17 00:00:00 2001
From: Martin Stjernholm <mast@lysator.liu.se>
Date: Wed, 27 Jun 2001 02:01:32 +0200
Subject: [PATCH] Fixed bogus touching of the "lesser" mapping_data struct
 which could cause false alarms when running with gc self-tests.

Rev: src/mapping.c:1.126
Rev: src/testsuite.in:1.428
---
 src/mapping.c    |  3 +-
 src/testsuite.in | 80 +++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 80 insertions(+), 3 deletions(-)

diff --git a/src/mapping.c b/src/mapping.c
index 8d6c60adac..081cf6517d 100644
--- a/src/mapping.c
+++ b/src/mapping.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: mapping.c,v 1.125 2001/06/26 21:03:50 hubbe Exp $");
+RCSID("$Id: mapping.c,v 1.126 2001/06/27 00:01:31 mast Exp $");
 #include "main.h"
 #include "object.h"
 #include "mapping.h"
@@ -2262,7 +2262,6 @@ unsigned gc_touch_all_mappings(void)
     fatal("Error in mapping link list.\n");
   for (m = first_mapping; m; m = m->next) {
     debug_gc_touch(m);
-    debug_gc_touch(m->data);
     n++;
     if (m->next && m->next->prev != m)
       fatal("Error in mapping link list.\n");
diff --git a/src/testsuite.in b/src/testsuite.in
index 507c5162e4..5ad488f063 100644
--- a/src/testsuite.in
+++ b/src/testsuite.in
@@ -1,4 +1,4 @@
-test_true([["$Id: testsuite.in,v 1.427 2001/06/23 10:33:11 hubbe Exp $"]]);
+test_true([["$Id: testsuite.in,v 1.428 2001/06/27 00:01:32 mast Exp $"]]);
 
 cond([[all_constants()->_verify_internals]],
 [[
@@ -3825,6 +3825,84 @@ ifefun(gc,
     gc();
     return sizeof (m);
   ]], 1)
+
+  test_any([[
+    return class {
+      mapping x;
+      int test()
+      {
+	object o = class {
+	    mapping a = ([1: this_object()]);
+	    void destroy() {x = a;}
+	  }();
+	o = 0;
+	gc();
+	return x && !x[1];
+      }
+    }()->test();
+  ]], 1)
+  test_any([[
+    return class {
+      multiset x;
+      int test()
+      {
+	object o = class {
+	    multiset a = (<this_object()>);
+	    void destroy() {x = a;}
+	  }();
+	o = 0;
+	gc();
+	return x && !sizeof (x + (<>));
+      }
+    }()->test();
+  ]], 1)
+  test_any([[
+    return class {
+      array x;
+      int test()
+      {
+	object o = class {
+	    array a = ({this_object()});
+	    void destroy() {x = a;}
+	  }();
+	o = 0;
+	gc();
+	return x && !x[0];
+      }
+    }()->test();
+  ]], 1)
+  test_any([[
+    return class {
+      class Obj (object o) {void destroy() {}}
+      Obj x;
+      int test()
+      {
+	object o = class {
+	    Obj a = Obj (this_object());
+	    void destroy() {x = a;}
+	  }();
+	o = 0;
+	gc();
+	return !x;
+      }
+    }()->test();
+  ]], 1)
+  test_any([[
+    return class {
+      class Obj (object o) {}
+      Obj x;
+      int test()
+      {
+	object o = class {
+	    Obj a = Obj (this_object());
+	    void destroy() {x = a;}
+	  }();
+	o = 0;
+	gc();
+	return x && !x->o;
+      }
+    }()->test();
+  ]], 1)
 ]])
 
 cond([[ sizeof( cpp("__AUTO_BIGNUM__")/"__AUTO_BIGNUM__" ) == 1 ]],
-- 
GitLab