Skip to content

Commit d2caeb1

Browse files
jhawthornk0kubun
authored andcommitted
Fix a missing write barrier to mandatory_only_iseq
Found by wbcheck
1 parent ffbccd4 commit d2caeb1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

compile.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9151,12 +9151,13 @@ compile_builtin_mandatory_only_method(rb_iseq_t *iseq, const NODE *node, const N
91519151

91529152
VALUE ast_value = rb_ruby_ast_new(RNODE(&scope_node));
91539153

9154-
ISEQ_BODY(iseq)->mandatory_only_iseq =
9154+
const rb_iseq_t *mandatory_only_iseq =
91559155
rb_iseq_new_with_opt(ast_value, rb_iseq_base_label(iseq),
91569156
rb_iseq_path(iseq), rb_iseq_realpath(iseq),
91579157
nd_line(line_node), NULL, 0,
91589158
ISEQ_TYPE_METHOD, ISEQ_COMPILE_DATA(iseq)->option,
91599159
ISEQ_BODY(iseq)->variable.script_lines);
9160+
RB_OBJ_WRITE(iseq, &ISEQ_BODY(iseq)->mandatory_only_iseq, (VALUE)mandatory_only_iseq);
91609161

91619162
ALLOCV_END(idtmp);
91629163
return COMPILE_OK;

prism_compile.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3503,7 +3503,7 @@ pm_compile_builtin_mandatory_only_method(rb_iseq_t *iseq, pm_scope_node_t *scope
35033503
pm_scope_node_init(&def.base, &next_scope_node, scope_node);
35043504

35053505
int error_state;
3506-
ISEQ_BODY(iseq)->mandatory_only_iseq = pm_iseq_new_with_opt(
3506+
const rb_iseq_t *mandatory_only_iseq = pm_iseq_new_with_opt(
35073507
&next_scope_node,
35083508
rb_iseq_base_label(iseq),
35093509
rb_iseq_path(iseq),
@@ -3515,6 +3515,7 @@ pm_compile_builtin_mandatory_only_method(rb_iseq_t *iseq, pm_scope_node_t *scope
35153515
ISEQ_COMPILE_DATA(iseq)->option,
35163516
&error_state
35173517
);
3518+
RB_OBJ_WRITE(iseq, &ISEQ_BODY(iseq)->mandatory_only_iseq, (VALUE)mandatory_only_iseq);
35183519

35193520
if (error_state) {
35203521
RUBY_ASSERT(ISEQ_BODY(iseq)->mandatory_only_iseq == NULL);

0 commit comments

Comments
 (0)