Bug #33243 MySQL 6.0 atomic operations fail to compile on PPC64
Submitted: 14 Dec 2007 13:33 Modified: 16 Mar 2008 10:45
Reporter: Daniel Fischer Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:6.0-bk, 6.0.4-alpha OS:MacOS (PPC64)
Assigned to: CPU Architecture:Any

[14 Dec 2007 13:33] Daniel Fischer
Description:
The server can't be compiled on Mac OS X on a 64-bit PPC cpu. 

Many warnings similar to this one:
../include/my_atomic.h:106: warning: 'transparent_union' attribute ignored

Some warnings similar to this one:
lf_hash.c:456: warning: pointer targets in initialization differ in signedness

Many errors similar to these:
lf_hash.c:117: error: incompatible type for argument 2 of 'my_atomic_storeptr'
lf_hash.c:126: error: incompatible type for argument 1 of 'my_atomic_casptr'

How to repeat:
Build from mysql-6.0 on Mac OS X 10.4 or 10.5 for 64-bit PowerPC, using vendor-supplied compiler.
[15 Dec 2007 14:57] Daniel Fischer
The reason is that in the following code (simplified test case), the transparent_union attribute is ignored:

typedef union {
  int volatile *i;
  unsigned int volatile *u;
} int_union
__attribute__ ((transparent_union));

This only happens on Mac OS X when building for the PPC64 target. It doesn't happen when building for any other CPU supported by Mac OS X.
[15 Dec 2007 15:46] Sergei Golubchik
Yes, this is my fix:

-#if defined(__GNUC__)
+#if defined(__GNUC__) && !defined(__cplusplus) && \
+      ! (defined(__APPLE__) && defined(_ARCH_PPC64))
[20 Dec 2007 10:15] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/40255

ChangeSet@1.2770, 2007-12-20 11:11:37+01:00, df@pippilotta.erinye.com +1 -0
  BUG#33243 transparent_union unhelpful on OS X PPC64
[20 Dec 2007 10:17] Daniel Fischer
Above patch was applied to 6.0.4 release clone.
[12 Mar 2008 23:03] Bugs System
Pushed into 6.0.4-alpha
[16 Mar 2008 10:45] MC Brown
No changelog entry required.