Issue #11790 has been reported by Zarko  Todorovski.

----------------------------------------
Bug #11790: [PATCH] ANSI alias rules fix 
https://bugs.ruby-lang.org/issues/11790

* Author: Zarko  Todorovski
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
line 70 in file regparse.h:
*#define SET_NTYPE(node, ntype)   (node)->u.base.type = (ntype)*

needs to be changed to conform with ANSI alias rules


Line 70 as it is can lead to errors in compiling in regparse.c

*line 1143: node = (Node* )FreeNodeList;*
*line 1144: FreeNodeList = FreeNodeList->next;*
*line 1581: (node)->u.base.type = (0);* 

where during compiling line 1581 can be moved ahead of line 1144 since under ANSI aliasing rules, the compiler determines that the statement of "(node)->u.base.type = (0);" does not affect the value of FreeNodeList. 

Proposed change in patch is in file regparse.sh:

from: 
*#define SET_NTYPE(node, ntype)   (node)->u.base.type = (ntype)*
to:
*#define SET_NTYPE(node, ntype)  {int value = ntype; memcpy(&((node)->u.base.type), &value, sizeof((node)->u.base.type));}*

---Files--------------------------------
alias_ansi_rule.patch (717 Bytes)


-- 
https://bugs.ruby-lang.org/