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

ruby-changes:43758

From: shyouhei <ko1@a...>
Date: Mon, 8 Aug 2016 13:20:03 +0900 (JST)
Subject: [ruby-changes:43758] shyouhei:r55831 (trunk): * internal.h (RBASIC_CLEAR_CLASS): Reroute ANSI C's strict

shyouhei	2016-08-08 13:19:58 +0900 (Mon, 08 Aug 2016)

  New Revision: 55831

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

  Log:
    * internal.h (RBASIC_CLEAR_CLASS): Reroute ANSI C's strict
      aliasing rule.
      	  [ruby-core:74427][Bug #12191][ruby-core:76747][Bug #12657]

  Modified files:
    trunk/ChangeLog
    trunk/internal.h
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55830)
+++ ChangeLog	(revision 55831)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Aug  8 12:51:12 2016  Zarko Todorovski <zarko@c...>
+
+	* internal.h (RBASIC_CLEAR_CLASS): Reroute ANSI C's strict
+	  aliasing rule.
+	  [ruby-core:74427][Bug #12191][ruby-core:76747][Bug #12657]
+
 Sun Aug  7 18:08:27 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* object.c (InitVM_Object): deprecate toplevel constants TRUE,
Index: internal.h
===================================================================
--- internal.h	(revision 55830)
+++ internal.h	(revision 55831)
@@ -1250,8 +1250,8 @@ struct RBasicRaw { https://github.com/ruby/ruby/blob/trunk/internal.h#L1250
     VALUE klass;
 };
 
-#define RBASIC_CLEAR_CLASS(obj)        (((struct RBasicRaw *)((VALUE)(obj)))->klass = 0)
-#define RBASIC_SET_CLASS_RAW(obj, cls) (((struct RBasicRaw *)((VALUE)(obj)))->klass = (cls))
+#define RBASIC_CLEAR_CLASS(obj)        memset(&(((struct RBasicRaw *)((VALUE)(obj)))->klass), 0, sizeof(((struct RBasicRaw *)
+#define RBASIC_SET_CLASS_RAW(obj, cls) memcpy(&((struct RBasicRaw *)((VALUE)(obj)))->klass, &(cls), sizeof(VALUE))
 #define RBASIC_SET_CLASS(obj, cls)     do { \
     VALUE _obj_ = (obj); \
     RB_OBJ_WRITE(_obj_, &((struct RBasicRaw *)(_obj_))->klass, cls); \

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

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