diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-08 04:19:58 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-08 04:19:58 +0000 |
commit | 869e7809a30f024ffa67fbfed7fa4b0eacad7475 (patch) | |
tree | ff57185762a691b15ee74b40fcae2f52de98b2cd | |
parent | 0c5fb7df2adb43b43a6f2a9b2404bf541a0d1a64 (diff) | |
download | ruby-869e7809a30f024ffa67fbfed7fa4b0eacad7475.tar.gz |
* internal.h (RBASIC_CLEAR_CLASS): Reroute ANSI C's strict
aliasing rule.
[ruby-core:74427][Bug #12191][ruby-core:76747][Bug #12657]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | internal.h | 4 |
2 files changed, 8 insertions, 2 deletions
@@ -1,3 +1,9 @@ +Mon Aug 8 12:51:12 2016 Zarko Todorovski <zarko@ca.ibm.com> + + * 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@ruby-lang.org> * object.c (InitVM_Object): deprecate toplevel constants TRUE, diff --git a/internal.h b/internal.h index b013f84616..369b32f90f 100644 --- a/internal.h +++ b/internal.h @@ -1250,8 +1250,8 @@ struct RBasicRaw { 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); \ |