Bug #60912 Do not assume an x86 build is little-endian
Submitted: 18 Apr 2011 21:36 Modified: 25 Oct 2018 6:45
Reporter: Paul Green (OCA) Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.1.48, 5.6.2 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution

[18 Apr 2011 21:36] Paul Green
Description:
The file include/my_global.h contains code to select two different implementations of data storage / retrieval macros depending on whether the target architecture is big-endian or little-endian.

The Stratus VOS / OpenVOS platform has always been a big-endian environment, and remains so even on the Intel x86-based platforms.  So the rather common real-world assumption that if the __i386__ macro is defined, then the platform must be little-endian, fails for the VOS / OpenVOS platform.  

The MySQL 5.1.48 configure script properly identifies the Stratus VOS / OpenVOS platform as a big-endian platform and defines the WORD_BIGENDIAN macro. I have not tested mysql-5.6.2-m5, but I can see that the my_global.h file is unchanged in this regard from 5.1.48, so the problem still exists in the current release.

An unrelated issue, in the same file (my_global.h) is that the code assumes that the "isnan" name is defined as a function but not defined as a macro. Our implementation only defines it as a macro. The fix is to only define the isnan macro if it is not already defined.

For the record, I encountered these issues while porting MySQL 5.1.48 to  Stratus OpenVOS Release 17.1, using gcc 3.4.6.

How to repeat:
You probably can't really reproduce this problem unless you have access to a Stratus OpenVOS system. I can arrange this, but I don't think you need to go that far; let me know if I can help.

Suggested fix:
See the patch file.
[18 Apr 2011 21:37] Paul Green
Patches to correct endian and isnan issues in my_global.h

Attachment: mysql.60912.diff (application/octet-stream, text), 1.03 KiB.

[19 Apr 2011 15:50] Valeriy Kravchuk
Thank you for the problem report and patch contributed.
[15 Apr 2015 8:13] Ståle Deraas
Posted by developer:
 
Paul,

We have no way to verify and maintain any changes to support this, as we have no platform in our labs running this config. We will therefore not take your contribution. Thank you anyway.

Staale