[ruby-core:97009] [Ruby master Bug#16598] Backport af899503 to ruby_2_7
From:
nobu@...
Date:
2020-01-28 00:58:22 UTC
List:
ruby-core #97009
Issue #16598 has been updated by nobu (Nobuyoshi Nakada).
Description updated
A patch without gc.rb.
```diff
commit 030a30a0dc301e79b147233d2142822915f7dde9
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
AuthorDate: 2020-01-27 10:46:57 +0900
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
CommitDate: 2020-01-28 09:49:53 +0900
Fixed a segfault `GC.verify_compaction_references`
Which is by coercion of `Qundef`, when any keyword argument
without `toward:` option is given. [Bug #16598]
diff --git a/gc.c b/gc.c
index 131ffb8246..4704925abc 100644
--- a/gc.c
+++ b/gc.c
@@ -8618,7 +8618,7 @@ gc_compact_after_gc(rb_objspace_t *objspace, int use_toward_empty, int use_doubl
/*
* call-seq:
- * GC.verify_compaction_references -> nil
+ * GC.verify_compaction_references(toward: nil, double_heap: nil) -> nil
*
* Verify compaction reference consistency.
*
@@ -8656,7 +8656,7 @@ gc_verify_compaction_references(int argc, VALUE *argv, VALUE mod)
}
rb_get_kwargs(opt, keyword_ids, 0, 2, kwvals);
- if (rb_intern("empty") == rb_sym2id(kwvals[0])) {
+ if (kwvals[0] != Qundef && rb_intern("empty") == rb_sym2id(kwvals[0])) {
use_toward_empty = TRUE;
}
if (kwvals[1] != Qundef && RTEST(kwvals[1])) {
diff --git a/test/ruby/test_gc_compact.rb b/test/ruby/test_gc_compact.rb
index e93e775279..75d9b01f2c 100644
--- a/test/ruby/test_gc_compact.rb
+++ b/test/ruby/test_gc_compact.rb
@@ -39,6 +39,8 @@
hash = list_of_objects.hash
GC.verify_compaction_references(toward: :empty)
assert_equal hash, list_of_objects.hash
+ GC.verify_compaction_references(double_heap: false)
+ assert_equal hash, list_of_objects.hash
end
def walk_ast ast
```
----------------------------------------
Bug #16598: Backport af899503 to ruby_2_7
https://bugs.ruby-lang.org/issues/16598#change-84095
* Author: nagachika (Tomoyuki Chikanaga)
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: -
* Backport: 2.5: DONTNEED, 2.6: DONTNEED, 2.7: REQUIRED
----------------------------------------
nobu said that the fix at [af899503] is also necessary for ruby_2_7 branch.
[af899503]: https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/af899503
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>