[前][次][番号順一覧][スレッド一覧]

ruby-changes:70858

From: Nobuyoshi <ko1@a...>
Date: Fri, 14 Jan 2022 13:46:35 +0900 (JST)
Subject: [ruby-changes:70858] c613d79f9b (master): Suppress unary minus operator to unsigned type warnings

https://git.ruby-lang.org/ruby.git/commit/?id=c613d79f9b

From c613d79f9b366409158fd599d76eb1261b657cac Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 14 Jan 2022 00:46:33 +0900
Subject: Suppress unary minus operator to unsigned type warnings

---
 yjit_codegen.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/yjit_codegen.c b/yjit_codegen.c
index 52ac8aaa323..8b60b85be41 100644
--- a/yjit_codegen.c
+++ b/yjit_codegen.c
@@ -931,7 +931,7 @@ gen_newarray(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L931
     // Save the PC and SP because we are allocating
     jit_prepare_routine_call(jit, ctx, REG0);
 
-    x86opnd_t values_ptr = ctx_sp_opnd(ctx, -(sizeof(VALUE) * (uint32_t)n));
+    x86opnd_t values_ptr = ctx_sp_opnd(ctx, -(int32_t)(sizeof(VALUE) * (uint32_t)n));
 
     // call rb_ec_ary_new_from_values(struct rb_execution_context_struct *ec, long n, const VALUE *elts);
     mov(cb, C_ARG_REGS[0], REG_EC);
@@ -1369,7 +1369,7 @@ gen_getlocal_generic(ctx_t *ctx, uint32_t local_idx, uint32_t level) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L1369
 
     // Load the local from the block
     // val = *(vm_get_ep(GET_EP(), level) - idx);
-    const int32_t offs = -(SIZEOF_VALUE * local_idx);
+    const int32_t offs = -(int32_t)(SIZEOF_VALUE * local_idx);
     mov(cb, REG0, mem_opnd(64, REG0, offs));
 
     // Write the local at SP
@@ -1501,7 +1501,7 @@ gen_setlocal_generic(jitstate_t *jit, ctx_t *ctx, uint32_t local_idx, uint32_t l https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L1501
     mov(cb, REG1, stack_top);
 
     // Write the value at the environment pointer
-    const int32_t offs = -(SIZEOF_VALUE * local_idx);
+    const int32_t offs = -(int32_t)(SIZEOF_VALUE * local_idx);
     mov(cb, mem_opnd(64, REG0, offs), REG1);
 
     return YJIT_KEEP_COMPILING;
@@ -1952,7 +1952,7 @@ gen_concatstrings(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L1952
     // Save the PC and SP because we are allocating
     jit_prepare_routine_call(jit, ctx, REG0);
 
-    x86opnd_t values_ptr = ctx_sp_opnd(ctx, -(sizeof(VALUE) * (uint32_t)n));
+    x86opnd_t values_ptr = ctx_sp_opnd(ctx, -(int32_t)(sizeof(VALUE) * (uint32_t)n));
 
     // call rb_str_concat_literals(long n, const VALUE *strings);
     mov(cb, C_ARG_REGS[0], imm_opnd(n));
@@ -4536,7 +4536,7 @@ gen_toregexp(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L4536
     // raise an exception.
     jit_prepare_routine_call(jit, ctx, REG0);
 
-    x86opnd_t values_ptr = ctx_sp_opnd(ctx, -(sizeof(VALUE) * (uint32_t)cnt));
+    x86opnd_t values_ptr = ctx_sp_opnd(ctx, -(int32_t)(sizeof(VALUE) * (uint32_t)cnt));
     ctx_stack_pop(ctx, cnt);
 
     mov(cb, C_ARG_REGS[0], imm_opnd(0));
@@ -4866,7 +4866,7 @@ gen_opt_invokebuiltin_delegate(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L4866
 
     // Copy arguments from locals
     for (int32_t i = 0; i < bf->argc; i++) {
-        const int32_t offs = -jit->iseq->body->local_table_size - VM_ENV_DATA_SIZE + 1 + start_index + i;
+        const int32_t offs = start_index + i - jit->iseq->body->local_table_size - VM_ENV_DATA_SIZE + 1;
         x86opnd_t local_opnd = mem_opnd(64, REG0, offs * SIZEOF_VALUE);
         x86opnd_t c_arg_reg = C_ARG_REGS[i + 2];
         mov(cb, c_arg_reg, local_opnd);
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]