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

ruby-changes:51760

From: ktsj <ko1@a...>
Date: Sun, 15 Jul 2018 20:42:21 +0900 (JST)
Subject: [ruby-changes:51760] ktsj:r63972 (trunk): vm_core.h, vm_dump.c: fix cast

ktsj	2018-07-15 20:42:15 +0900 (Sun, 15 Jul 2018)

  New Revision: 63972

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63972

  Log:
    vm_core.h, vm_dump.c: fix cast
    
    Revert r63968 and cast at caller side to prevent unintentional casting.

  Modified files:
    trunk/vm_core.h
    trunk/vm_dump.c
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 63971)
+++ vm_core.h	(revision 63972)
@@ -1062,7 +1062,7 @@ typedef rb_control_frame_t * https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1062
   (FUNC_FASTCALL(*rb_insn_func_t))(rb_execution_context_t *, rb_control_frame_t *);
 
 #define VM_TAGGED_PTR_SET(p, tag)  ((VALUE)(p) | (tag))
-#define VM_TAGGED_PTR_REF(v, mask) ((void *)((VALUE)(v) & ~mask))
+#define VM_TAGGED_PTR_REF(v, mask) ((void *)((v) & ~mask))
 
 #define GC_GUARDED_PTR(p)     VM_TAGGED_PTR_SET((p), 0x01)
 #define GC_GUARDED_PTR_REF(p) VM_TAGGED_PTR_REF((p), 0x03)
Index: vm_dump.c
===================================================================
--- vm_dump.c	(revision 63971)
+++ vm_dump.c	(revision 63972)
@@ -151,7 +151,7 @@ rb_vmdebug_stack_dump_raw(const rb_execu https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L151
 
 	t = (VALUE *)*p;
 	if (ec->vm_stack <= t && t < sp) {
-	    fprintf(stderr, " (= %ld)", (long)((VALUE *)GC_GUARDED_PTR_REF(t) - ec->vm_stack));
+	    fprintf(stderr, " (= %ld)", (long)((VALUE *)GC_GUARDED_PTR_REF((VALUE)t) - ec->vm_stack));
 	}
 
 	if (p == ep)

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

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