Bug #12040 Compile error GCC4 x86_64: ha_ndbcluster.cc:710: error: cast from ‘char*’ to ‘u
Submitted: 19 Jul 2005 19:58 Modified: 29 Jul 2005 17:21
Reporter: Elliot Murphy Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version: OS:
Assigned to: Elliot Murphy CPU Architecture:Any

[19 Jul 2005 19:58] Elliot Murphy
Description:
Compile failure due to bad cast for printing a pointer in a DBUG_PRINT.

uname -a reports:
Linux dl145k.mysql.com 2.6.12-1.1390_FC4smp #1 SMP Tue Jul 5 20:09:48 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux

gcc --version reports:
gcc (GCC) 4.0.0 20050519 (Red Hat 4.0.0-8)

Latest 5.0 source from BK (5.0.10-pre)

Error is:
ha_ndbcluster.cc: In member function ‘int ha_ndbcluster::set_ndb_value(NdbOperation*, Field*, uint, bool*)’:
ha_ndbcluster.cc:710: error: cast from ‘char*’ to ‘unsigned int’ loses precision

How to repeat:
Compile -max with GCC4 on AMD64. Interestingly, I don't see this error on OS X G5 w/ gcc4, although it is probably a warning.

Suggested fix:
Per discussions with Stewart Smith, use %p instead of %x in DBUG_PRINT and drop the cast to uint.
[19 Jul 2005 20:04] 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/internals/27322
[19 Jul 2005 20:42] Elliot Murphy
Fix is pushed for 5.0.10
[29 Jul 2005 17:21] Mike Hillyer
Documented in 5.0.10 changelog:

<listitem><para>Fixed compile error when using GCC4 on AMD64. (Bug #12040)</para></listitem>