Skip to content

Commit ce47ee0

Browse files
committed
Fix indirect counter increment
`*pcnt++` just dereferences `pcnt` then increments the local variable, but has no side effect.
1 parent 04a2550 commit ce47ee0

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

bootstraptest/test_ractor.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1494,8 +1494,9 @@ class C
14941494

14951495
# NameError
14961496
assert_equal "ok", %q{
1497+
obj = "".freeze # NameError refers the receiver indirectly
14971498
begin
1498-
bar
1499+
obj.bar
14991500
rescue => err
15001501
end
15011502
begin

ractor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3127,7 +3127,7 @@ obj_refer_only_shareables_p_i(VALUE obj, void *ptr)
31273127
int *pcnt = (int *)ptr;
31283128

31293129
if (!rb_ractor_shareable_p(obj)) {
3130-
*pcnt++;
3130+
++*pcnt;
31313131
}
31323132
}
31333133

0 commit comments

Comments
 (0)