Bug #34169 Compiling failed
Submitted: 30 Jan 2008 16:59 Modified: 12 Mar 2008 9:42
Reporter: Susanne Ebrecht Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:5.0, 5.1, 6.0 OS:FreeBSD (AMD 64)
Assigned to: Pekka Nousiainen CPU Architecture:Any

[30 Jan 2008 16:59] Susanne Ebrecht
Description:
gcc -DHAVE_CONFIG_H -DNDB_DEBUG -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD -I. -I. -I../../../include -I../../../ndb/src/mgmapi -I. -I../../../include -I../../../ndb/include -I../../../include -I../../../mysys -I../../../ndb/include -I../../../ndb/include/kernel -I../../../ndb/include/transporter -I../../../ndb/include/debugger -I../../../ndb/include/mgmapi -I../../../ndb/include/mgmcommon -I../../../ndb/include/ndbapi -I../../../ndb/include/util -I../../../ndb/include/portlib -I../../../ndb/include/logger -g -DDBUG_ON -DSAFE_MUTEX -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -mtune=nocona -DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX -O1 -Wuninitialized -fno-implicit-templates -fno-exceptions -fno-rtti -DMYSQLD_NET_RETRY_COUNT=1000000 -MT Ndb.lo -MD -MP -MF .deps/Ndb.Tpo -c Ndb.cpp  -fPIC -DPIC -o .libs/Ndb.o
Ndb.cpp: In member function 'void Ndb::printState(const char*, ...)':
Ndb.cpp:1420: error: cast from 'pthread*' to 'int' loses precision
../../../ndb/include/kernel/BlockNumbers.h: At global scope:
../../../ndb/include/kernel/BlockNumbers.h:48: warning: 'BACKUP_REF' defined but not used
../../../ndb/include/kernel/BlockNumbers.h:49: warning: 'DBTC_REF' defined but not used
../../../ndb/include/kernel/BlockNumbers.h:50: warning: 'DBDIH_REF' defined but not used
../../../ndb/include/kernel/BlockNumbers.h:51: warning: 'DBLQH_REF' defined but not used
../../../ndb/include/kernel/BlockNumbers.h:52: warning: 'DBACC_REF' defined but not used
../../../ndb/include/kernel/BlockNumbers.h:53: warning: 'DBTUP_REF' defined but not used
../../../ndb/include/kernel/BlockNumbers.h:54: warning: 'DBDICT_REF' defined but not used
../../../ndb/include/kernel/BlockNumbers.h:55: warning: 'NDBCNTR_REF' defined but not used
../../../ndb/include/kernel/BlockNumbers.h:56: warning: 'QMGR_REF' defined but not used
../../../ndb/include/kernel/BlockNumbers.h:57: warning: 'NDBFS_REF' defined but not used
../../../ndb/include/kernel/BlockNumbers.h:58: warning: 'CMVMI_REF' defined but not used
../../../ndb/include/kernel/BlockNumbers.h:59: warning: 'TRIX_REF' defined but not used
../../../ndb/include/kernel/BlockNumbers.h:60: warning: 'DBUTIL_REF' defined but not used
../../../ndb/include/kernel/BlockNumbers.h:61: warning: 'SUMA_REF' defined but not used
../../../ndb/include/kernel/BlockNumbers.h:62: warning: 'DBTUX_REF' defined but not used
gmake[4]: *** [Ndb.lo] Fehler 1
gmake[4]: Leaving directory `/usr/home/miracee/mysql50rlsrc/mysql-5.0.51a/ndb/src/ndbapi'
gmake[3]: *** [install-recursive] Fehler 1
gmake[3]: Leaving directory `/usr/home/miracee/mysql50rlsrc/mysql-5.0.51a/ndb/src'
gmake[2]: *** [install-recursive] Fehler 1
gmake[2]: Leaving directory `/usr/home/miracee/mysql50rlsrc/mysql-5.0.51a/ndb'
gmake[1]: *** [install-recursive] Fehler 1
gmake[1]: Leaving directory `/usr/home/miracee/mysql50rlsrc/mysql-5.0.51a'

$ gcc --version
gcc (GCC) 4.2.3 20071024

How to repeat:
$ ./BUILD/compile-amd64-debug-max -c
gmake
[30 Jan 2008 17:02] Susanne Ebrecht
Fehler == Error
[1 Feb 2008 15:10] Hartmut Holzgraefe
Ndb.cpp: In member function 'void Ndb::printState(const char*, ...)': Ndb.cpp:1420: error: cast from 'pthread*' to 'int' loses precision

the problem is:

      ndbout << " thread=" << (int)pthread_self();

as pthread_self() returns a pthread_t pointer and as the assertion

  sizeof(int) == sizeof(pointer) 

does not hold true on all platforms.

Replacing the cast to "(int)" with a cast to "(void *)" 
makes the compiler happy and works fine with cout,
so it should probably work just fine with ndbout, too

This change would change the output from

  thread= large_decimal_number

to 

  thread= 0xlarge_hex_number

but i don't think that we have anything relying
on that output format and for humans the 0xHEX
format seems to be more easy to mentally parse
anyway ...
[2 Feb 2008 9:30] Jonas Oreland
work-around: dont use gcc 4.3 or dont compile debug 
an ok fix is to remove code all together
[4 Feb 2008 8:23] 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/41624

ChangeSet@1.2594, 2008-02-04 09:23:56+01:00, pekka@sama.ndb.mysql.com +2 -0
  bug#34169 - fix pthread_t abuse
[12 Feb 2008 14:57] Jon Stephens
Documented in the 5.1.23-ndb-6.3.9 changelog as follows:

        When configured with NDB support, MySQL
        failed to compile on 64-bit FreeBSD systems.

Left in PP status pending further merges.
[12 Feb 2008 16:07] Jon Stephens
Also documented for 5.1.23-ndb-6.2.12.
[18 Feb 2008 11:14] Susanne Ebrecht
Bug #34585 is a duplicate of this bug here.

Also it occurs with both: bk tree for 5.0 and bk tree for 5.1
[20 Feb 2008 16:02] Bugs System
Pushed into 5.0.58
[20 Feb 2008 16:02] Bugs System
Pushed into 5.1.24-rc
[20 Feb 2008 16:03] Bugs System
Pushed into 6.0.5-alpha
[2 Mar 2008 9:28] Jon Stephens
Also documented for 5.0.58, 5.1.24, and 6.0.5; closed.
[3 Mar 2008 21:45] Jon Stephens
Removed changelog entries for bugfix due to bug being re-opened.
[7 Mar 2008 12:42] Susanne Ebrecht
It's also at version 6.0 bk tree from 2008-03-07

Ndb.cpp: In member function 'void Ndb::printState(const char*, ...)':
Ndb.cpp:1881: error: cast from 'pthread*' to 'int' loses precision

I think gcc version is irrelevant here ... I tested with 4.2.3
$ gmake --version
GNU Make 3.81
[12 Mar 2008 8:49] Susanne Ebrecht
Jon,

please close this bug again. It works now.
[12 Mar 2008 9:42] Jon Stephens
Restored changelog entry per discussion with Susanne; closed.