Bug #90639 compile warning of uninitialized variable
Submitted: 26 Apr 2018 3:03 Modified: 3 May 2018 18:22
Reporter: zhai weixiang (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:8.0.11 OS:Any
Assigned to: CPU Architecture:Any

[26 Apr 2018 3:03] zhai weixiang
Description:
compile and check the output

/8.0/sql/auth/sql_authentication.cc: In function ‘int sha256_password_authenticate(MYSQL_PLUGIN_VIO*, MYSQL_SERVER_AUTH_INFO*)’:
/8.0/sql/auth/sql_authentication.cc:4022:3: warning: ‘is_error’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   if (is_error) {
   ^

How to repeat:
make 

Suggested fix:
init is_error to 0
[26 Apr 2018 8:25] MySQL Verification Team
Hello Zhai,

Thank you for the report and feedback.
Could you please provide exact cmake with the options(any flags set) used, gcc version and OS details? I have tried it on multiple boxes OL7(4.8.3, 6.4.0), FC27(gcc 7.3), Ubuntu(gcc 7.2) with below cmake but not seeing any warnings as such which you have noted.

cmake ..  -DWITH_BOOST=../boost/ -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_release -DFEATURE_SET=community [-DCMAKE_BUILD_TYPE=Debug] etc

Thanks,
Umesh
[26 Apr 2018 12:52] zhai weixiang
Hi, Umesh
bellow is my enviroment:
redhat, gcc4.9.2, 

COMMON_FLAGS="-O3 -g -fexceptions -fno-omit-frame-pointer -fno-strict-aliasing -fPIC -std=c++11"
CFLAGS="$COMMON_FLAGS"
CXXFLAGS="$COMMON_FLAGS"
CC=/usr/local/gcc-4.9.2/bin/gcc
CXX=/usr/local/gcc-4.9.2/bin/g++
export CC CFLAGS CXX CXXFLAGS

Actually you can verify this bug by checking the code:
- in function sha256_password_authenticate, is_error is not inited, and be used as parameter of compare_sha256_password_with_hash
- in function compare_sha256_password_with_hash, it may return -1 without setting is_error
[3 May 2018 18:22] Paul DuBois
Posted by developer:
 
Fixed in 8.0.12.

Code cleanup. No changelog entry needed.