Bug #83308 NDB Cluster doesn't compile with GCC6 (debug build)
Submitted: 8 Oct 2016 10:19 Modified: 4 Nov 2016 20:05
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:7.5.3 OS:Any
Assigned to: CPU Architecture:Any
Tags: compile, gcc

[8 Oct 2016 10:19] Daniël van Eeden
Description:
Branch: cluster-7.5 (c4f655a)

Compiling with -DCMAKE_BUILD_TYPE=Debug fails

mysql-server/storage/ndb/src/kernel/vm/Emulator.cpp: In member function ‘void EmulatorData::destroy()’:
mysql-server/storage/ndb/src/kernel/vm/Emulator.cpp:730:3: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
   if(theConfiguration)
   ^~

mysql-server/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp: In member function ‘int Dbtup::read_pseudo(const Uint32*, Uint32, Dbtup::KeyReqStruct*, Uint32*)’:
mysql-server/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp:2554:28: error: placement new constructing an object of type ‘Signal’ and size ‘32816’ in a region of type ‘SignalT<2u>’ and size ‘56’ [-Werror=placement-new=]
     Signal * signal = new (&signalT) Signal(0);

How to repeat:
Try to compile cluster-7.5 with build type Debug and GCC 6.2.1

Suggested fix:
The first set or warnings about EmulatorData::destory() is easy to fix. It looks like the if statement is misleading and not doing what was probably intended.

This:
730   if(theConfiguration)
731     delete theConfiguration; theConfiguration = 0;

Should probably be something like this:
730   if(theConfiguration)
731   {
731     delete theConfiguration;
732     theConfiguration = 0;
733   }

Or this:
730   if(theConfiguration)
731     delete theConfiguration;
732   theConfiguration = 0;

I don't have a suggestion for the second set of errors/warnings
[8 Oct 2016 10:19] Daniël van Eeden
Related:
Bug #82715 	Fix compile w/ G++ 6.1.1 on Fedora 24 (contribution)
[8 Oct 2016 11:04] Daniël van Eeden
And for a non-debug build this fix is needed: https://bugs.mysql.com/bug.php?id=80996
[10 Oct 2016 6:47] MySQL Verification Team
Hello Daniël,

Thank you for the report.
Verified as described.

Thanks,
Umesh
[4 Nov 2016 20:05] Jon Stephens
Documented fix in the NDB 7.5.5 changelog as follows:

    MySQL Cluster failed to compile using GCC 6.

Closed.