ruby-changes:57818
From: Nobuyoshi <ko1@a...>
Date: Fri, 20 Sep 2019 00:20:37 +0900 (JST)
Subject: [ruby-changes:57818] 82f25404ff (master): Check COMPILE_RECV result
https://git.ruby-lang.org/ruby.git/commit/?id=82f25404ff From 82f25404ffe2ad910ac61e436f02cad312755b2f Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 19 Sep 2019 23:44:37 +0900 Subject: Check COMPILE_RECV result diff --git a/compile.c b/compile.c index eabfa65..58b3b77 100644 --- a/compile.c +++ b/compile.c @@ -352,7 +352,7 @@ static void iseq_add_setlocal(rb_iseq_t *iseq, LINK_ANCHOR *const seq, int line, https://github.com/ruby/ruby/blob/trunk/compile.c#L352 #define COMPILE_RECV(anchor, desc, node) \ (private_recv_p(node) ? \ (ADD_INSN(anchor, nd_line(node), putself), VM_CALL_FCALL) : \ - (COMPILE(anchor, desc, node->nd_recv), 0)) + COMPILE(anchor, desc, node->nd_recv) ? 0 : -1) #define OPERAND_AT(insn, idx) \ (((INSN*)(insn))->operands[(idx)]) @@ -7057,7 +7057,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L7057 case NODE_OP_ASGN1: { VALUE argc; unsigned int flag = 0; - unsigned int asgnflag = 0; + int asgnflag = 0; ID id = node->nd_mid; int boff = 0; @@ -7088,6 +7088,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L7088 ADD_INSN(ret, line, putnil); } asgnflag = COMPILE_RECV(ret, "NODE_OP_ASGN1 recv", node); + CHECK(asgnflag != -1); switch (nd_type(node->nd_args->nd_head)) { case NODE_ZLIST: argc = INT2FIX(0); @@ -7191,7 +7192,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L7192 case NODE_OP_ASGN2:{ ID atype = node->nd_next->nd_mid; ID vid = node->nd_next->nd_vid, aid = rb_id_attrset(vid); - VALUE asgnflag; + int asgnflag; LABEL *lfin = NEW_LABEL(line); LABEL *lcfin = NEW_LABEL(line); LABEL *lskip = 0; @@ -7238,6 +7239,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L7239 */ asgnflag = COMPILE_RECV(ret, "NODE_OP_ASGN2#recv", node); + CHECK(asgnflag != -1); if (node->nd_next->nd_aid) { lskip = NEW_LABEL(line); ADD_INSN(ret, line, dup); @@ -8231,7 +8233,9 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L8233 argc = setup_args(iseq, args, node->nd_args, &flag, NULL); CHECK(!NIL_P(argc)); - flag |= COMPILE_RECV(recv, "recv", node); + int asgnflag = COMPILE_RECV(recv, "recv", node); + CHECK(asgnflag != -1); + flag |= (unsigned int)asgnflag; debugp_param("argc", argc); debugp_param("nd_mid", ID2SYM(mid)); -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/