summaryrefslogtreecommitdiff
path: root/regparse.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-09 08:02:06 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-09 08:02:06 (GMT)
commit1263f82a592d334e0ed4d03fb5b350b4733ca398 (patch)
tree80caf5f5a2451ffa7b50e2dbab61f237518348a4 /regparse.h
parent6e6dcf2a6ceee796022206900f96a954380d35f1 (diff)
regparse.h: ANSI alias rule fix
* regparse.h (SET_NTYPE): get rid of breaking strict aliasing. patch by Zarko Todorovski in [ruby-core:71953]. [Bug #11790] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regparse.h')
-rw-r--r--regparse.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/regparse.h b/regparse.h
index 35de546..caf0790 100644
--- a/regparse.h
+++ b/regparse.h
@@ -67,7 +67,11 @@ RUBY_SYMBOL_EXPORT_BEGIN
BIT_NT_CANY | BIT_NT_BREF)) != 0)
#define NTYPE(node) ((node)->u.base.type)
-#define SET_NTYPE(node, ntype) (node)->u.base.type = (ntype)
+#define SET_NTYPE(node, ntype) \
+ do { \
+ int value = ntype; \
+ memcpy(&((node)->u.base.type), &value, sizeof(int)); \
+ } while (0)
#define NSTR(node) (&((node)->u.str))
#define NCCLASS(node) (&((node)->u.cclass))