From af597321e5feb8937f410b44846c031ac29c700d Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 3 Jan 2018 23:05:02 +0000 Subject: compile.c: fix disasm dump * compile.c (DECL_ANCHOR): initialize as anchor type, which is not a valid iseq element. * compile.c (BADINSN_DUMP): dump from the first element, excluding the anchor itself. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index 425d875fd1..0d6ffaaa62 100644 --- a/compile.c +++ b/compile.c @@ -36,6 +36,7 @@ typedef struct iseq_link_element { enum { + ISEQ_ELEMENT_ANCHOR, ISEQ_ELEMENT_LABEL, ISEQ_ELEMENT_INSN, ISEQ_ELEMENT_ADJUST, @@ -438,7 +439,7 @@ do { \ /* leave name uninitialized so that compiler warn if INIT_ANCHOR is * missing */ #define DECL_ANCHOR(name) \ - LINK_ANCHOR name[1] = {{{0,},}} + LINK_ANCHOR name[1] = {{{ISEQ_ELEMENT_ANCHOR,},}} #define INIT_ANCHOR(name) \ (name->last = &name->anchor) @@ -1712,7 +1713,7 @@ get_ivar_ic_value(rb_iseq_t *iseq,ID id) } #define BADINSN_DUMP(anchor, list, dest) \ - dump_disasm_list_with_cursor(&anchor->anchor, list, dest) + dump_disasm_list_with_cursor(FIRST_ELEMENT(anchor), list, dest) #define BADINSN_ERROR \ (xfree(generated_iseq), \ @@ -1923,6 +1924,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor) } break; } + default: break; } list = list->next; } @@ -2242,6 +2244,7 @@ get_destination_insn(INSN *iobj) events |= trace->event; } break; + default: break; } list = list->next; } -- cgit v1.2.3