Bug #77637 mysql 5.6.25 compiled warning
Submitted: 7 Jul 2015 10:11 Modified: 7 Jul 2015 12:12
Reporter: jacky chen Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.6.25 OS:CentOS (6.3 x86_64)
Assigned to: CPU Architecture:Any

[7 Jul 2015 10:11] jacky chen
Description:
when i install Compile source code on centos 6.3, steps as below, will encounter warnings.
1. install relevant software required.
yum install cmake make gcc gcc-c++ ncurses ncurses-devel libaio-devel

relevant software version:
make-3.81-20.el6.x86_64
cmake-2.8.12.2-4.el6.x86_64
gcc-c++-4.4.7-11.el6.x86_64
gcc-4.4.7-11.el6.x86_64
bison (GNU Bison) 3.0 (compile install)

2. building with cmake.
cmake . 
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.6.25 
-DMYSQL_UNIX_ADDR=/usr/local/mysql-5.6.25/mysql.sock 
-DENABLE_DEBUG_SYNC=0 
-DINSTALL_SQLBENCHDIR= 
-DENABLED_PROFILING=1 
-DWITH_INNOBASE_STORAGE_ENGINE=1 
-DWITH_PARTITION_STORAGE_ENGINE=1 
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 
-DWITH_EMBEDDED_SERVER=0 
-DINSTALL_MYSQLTESTDIR= 
-DDEFAULT_CHARSET=utf8

3. when compiling, encounter warnings as below.
make
/root/mysql-5.6.25/sql/sql_planner.cc: In member function ‘void Optimize_table_order::best_access_path(JOIN_TAB*, table_map, uint, bool, double, POSITION*, POSITION*)’:
/root/mysql-5.6.25/sql/sql_planner.cc:431: warning: ‘loose_scan_opt.Loose_scan_opt::best_loose_scan_start_key’ may be used uninitialized in this function
/root/mysql-5.6.25/sql/sql_planner.cc:431: warning: ‘loose_scan_opt.Loose_scan_opt::best_max_loose_keypart’ may be used uninitialized in this function
/root/mysql-5.6.25/sql/sql_planner.cc:431: warning: ‘loose_scan_opt.Loose_scan_opt::best_loose_scan_records’ may be used uninitialized in this function
/root/mysql-5.6.25/sql/sql_planner.cc:431: warning: ‘loose_scan_opt.Loose_scan_opt::best_loose_scan_key’ may be used uninitialized in this function
/root/mysql-5.6.25/sql/sql_planner.cc:431: warning: ‘loose_scan_opt.Loose_scan_opt::quick_max_loose_keypart’ may be used uninitialized in this function

How to repeat:
Compile source code on centos 6.3

Suggested fix:
don't know.
[7 Jul 2015 10:12] jacky chen
mysql 5.6.25 compiled warning
[7 Jul 2015 12:12] MySQL Verification Team
Hello jacky chen,

Thank you for the report.

Thanks,
Umesh
[10 Aug 2015 14:53] Tor Didriksen
Posted by developer:
 
This is actually intentional, comments in the code:

    /*
      We needn't initialize:
      bound_sj_equalities - protected by try_loosescan
      quick_max_loose_keypart - protected by quick_uses_applicable_index
      best_loose_scan_key - protected by best_loose_scan_cost != DBL_MAX
      best_loose_scan_records - same
      best_max_loose_keypart - same
      best_loose_scan_start_key - same
      Not initializing them causes compiler warnings with g++ at -O1 or higher,
      but initializing them would cause a 2% CPU time loss in a 20-table plan
      search. So we initialize only if warnings would stop the build.
    */

To silence it, you can run cmake with -DMYSQL_MAINTAINER_MODE=1