summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/gc.c b/gc.c
index 2386ec422c..bcc3f87642 100644
--- a/gc.c
+++ b/gc.c
@@ -9209,10 +9209,16 @@ rb_gc_register_address(VALUE *addr)
tmp->varptr = addr;
global_list = tmp;
- /* obj has to be guarded here because the allocation above could trigger a
- * GC. However, C extensions could pass a pointer to a global variable
- * which does not exist on the stack and thus could get swept. */
+ /*
+ * Because some C extensions have assignment-then-register bugs,
+ * we guard `obj` here so that it would not get swept defensively.
+ */
RB_GC_GUARD(obj);
+ if (0 && !SPECIAL_CONST_P(obj)) {
+ rb_warn("Object is assigned to registering address already: %"PRIsVALUE,
+ rb_obj_class(obj));
+ rb_print_backtrace();
+ }
}
void