Bug #95840 Compilation with g++ 9.1.1 fails
Submitted: 17 Jun 2019 13:24 Modified: 21 Jun 2019 8:48
Reporter: Zbigniew Romanowski Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:8.0.16 OS:Fedora (version 30)
Assigned to: CPU Architecture:x86 (Intel(R) Core(TM) i5-3230M CPU @ 2.60GHz)

[17 Jun 2019 13:24] Zbigniew Romanowski
Description:
During compilation with compiler g++ (GCC) 9.1.1 20190503 (Red Hat 9.1.1-1) the following error occurrs:

/mysql-server/router/src/http/src/kdf_pbkdf2.cc:53:18: error: comparison of integer expressions of different signedness: ‘std::vector<unsigned char>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Werror=sign-compare]
   53 |   if (out.size() > std::numeric_limits<int>::max()) {

How to repeat:
cmake ../mysql-server -DCMAKE_CXX_COMPILER=g++  -DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE=Debug

make

Suggested fix:
Change the line mysql-server/router/src/http/src/kdf_pbkdf2.cc:53 to 
if (out.size() > std::numeric_limits<size_t>::max())
[18 Jun 2019 13:13] Zbigniew Romanowski
The name of OS and CPU architecture have been apecified.
[21 Jun 2019 8:22] Tor Didriksen
Fixed in 8.0.18.

'out' is a fixed-size vector, so I guess if(out.size() > max(int)) has been treated as if(false) by all compilers, until gcc9.1

out.size() is a size_t, so it cannot possibly be > max<size_t>

So, our solution was to simply remove the test, and the accompanying throw()
[21 Jun 2019 8:48] Erlend Dahl
Duplicate of

Bug#95585 Compilation errors with gcc 9.1.1