Issue #12657 has been updated by Nobuyoshi Nakada.
Description updated
Status changed from Open to Feedback
Does this patch really compile?
`cls` in `RBASIC_CLEAR_CLASS` sometimes isn't an l-value, and should not be able to be the operand of unary '&'.
----------------------------------------
Bug #12657: [PATCH] ANSI aliasing fix for XL compiler
https://bugs.ruby-lang.org/issues/12657#change-59981
* Author: Zarko Todorovski
* Status: Feedback
* Priority: Normal
* Assignee:
* ruby -v: 2.3.1
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
This is related to Bug #12191.
Changing in internal.h:983-985
from :
```diff
-#define RBASIC_CLEAR_CLASS(obj) (((struct RBasicRaw *)((VALUE)(obj)))->klass = 0)
-#define RBASIC_SET_CLASS_RAW(obj, cls) (((struct RBasicRaw *)((VALUE)(obj)))->klass = (cls))
```
to:
```C
#ifdef __ibmxl__
#define RBASIC_SET_CLASS_RAW(obj, cls) memcpy(&((struct RBasicRaw *)((VALUE)(obj)))->klass, &(cls), sizeof(VALUE))
#else
#define RBASIC_SET_CLASS_RAW(obj, cls) (((struct RBasicRaw *)((VALUE)(obj)))->klass = (cls))
#endif
#ifdef __ibmxl__
#define RBASIC_CLEAR_CLASS(obj) memset(&(((struct RBasicRaw *)((VALUE)(obj)))->klass), 0, sizeof(((struct RBasicRaw *)((VALUE)(obj)))->klass))
#else
#define RBASIC_CLEAR_CLASS(obj) (((struct RBasicRaw *)((VALUE)(obj)))->klass = 0)
#endif
```
This allows for ruby to build using XL compiler. Otherwise build fails because of ANSI aliasing issues.
---Files--------------------------------
RBASIC_aliasing.patch (1.04 KB)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>