[ruby-core:77853] [Ruby trunk Bug#12657] [PATCH] ANSI aliasing fix for XL compiler
From:
v.ondruch@...
Date:
2016-11-01 12:38:03 UTC
List:
ruby-core #77853
Issue #12657 has been updated by Vit Ondruch.
Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: UNKNOWN, 2.2: REQUIRED, 2.3: REQUIRED
I checked that the patches fix the warnings in Ruby 2.2. BTW r55833 is required alongside of r55831
----------------------------------------
Bug #12657: [PATCH] ANSI aliasing fix for XL compiler
https://bugs.ruby-lang.org/issues/12657#change-61167
* Author: Zarko Todorovski
* Status: Closed
* Priority: Normal
* Assignee:
* ruby -v: 2.3.1
* Backport: 2.1: UNKNOWN, 2.2: REQUIRED, 2.3: REQUIRED
----------------------------------------
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>