From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS41665 78.109.16.0/20 X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00,RCVD_IN_MSPIKE_BL, RCVD_IN_MSPIKE_ZBI,RCVD_IN_XBL,SPF_FAIL,SPF_HELO_FAIL,TO_EQ_FM_DOM_SPF_FAIL shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from 80x24.org (tornode.torreactor.ml [78.109.23.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 6C49420D11 for ; Tue, 6 Jun 2017 01:29:45 +0000 (UTC) From: Eric Wong To: spew@80x24.org Subject: [PATCH] mjit: fix -Werror=Wshorten-64-to-32 errors on clang Date: Tue, 6 Jun 2017 01:29:44 +0000 Message-Id: <20170606012944.26869-1-e@80x24.org> List-Id: Build tested on clang 3.8.0 and gcc 6.3.0 on FreeBSD 11.0 * mjit.c (translate_iseq_insn): use ptrdiff_t for call_ivar_obj_op (mjit_store_failed_spec_insn): cast insn to "enum ruby_vminsn_type" (batch_iseq_compare): recast subtraction result to int --- mjit.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mjit.c b/mjit.c index 7590ff0ed2..32a9c9074a 100644 --- a/mjit.c +++ b/mjit.c @@ -1324,7 +1324,8 @@ translate_iseq_insn(FILE *f, size_t pos, struct rb_mjit_batch_iseq *bi, && (local_cc.call == vm_call_ivar || local_cc.call == vm_call_attrset) && local_cc.aux.index > 0) { ptrdiff_t call_start = code[pos + 2]; - int call_ivar_obj_op = features.recv_p ? code[pos + 2] : code[pos + 3]; + ptrdiff_t call_ivar_obj_op = features.recv_p ? code[pos + 2] + : code[pos + 3]; const char *rec = (insn == BIN(simple_call_self) ? "&cfp->self" : get_op_str(buf, call_ivar_obj_op, tcp)); @@ -2361,7 +2362,7 @@ mjit_store_failed_spec_insn(rb_iseq_t *iseq, size_t pc, int mutation_num) { insn = rb_vm_insn_addr2insn((void *) insn); #endif bi->mutation_insns[mutation_num].pc = pc; - bi->mutation_insns[mutation_num].insn = insn; + bi->mutation_insns[mutation_num].insn = (enum ruby_vminsn_type)insn; } /* It is called when our whole function speculation about ivar @@ -2617,7 +2618,7 @@ batch_iseq_compare(const void *el1, const void *el2) { if (overall_calls2 < overall_calls1) return -1; if (overall_calls1 < overall_calls2) return 1; - return (long) bi2->iseq_size - (long) bi1->iseq_size; + return (int)((long) bi2->iseq_size - (long) bi1->iseq_size); } /* Allocate and return a new array of done batch iseqs sorted -- EW