Description:
Hi,
I have a request to update the source code to handle comparing float and double values. We recently upgraded our gcc compiler (or turned on some setting, I don't recall which) which errors when floats and doubles are compared in an unsafe manner. For our compilation of our custom storage engine, we have to add this flag to build -Wno-error=float-equal. This generates warnings instead of errors.
gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16)
Here are the files and warnings in question that I care about:
mysql5.7.11/include/plugin/sql/handler.h: In member function 'bool Cost_estimate::is_zero() const':
mysql5.7.11/include/plugin/sql/handler.h:1723: warning: comparing floating point with == or != is unsafe
mysql5.7.11/include/plugin/sql/handler.h:1730: warning: comparing floating point with == or != is unsafe
mysql5.7.11/include/plugin/sql/key.h: In member function 'bool st_key::has_records_per_key(uint) const':
mysql5.7.11/include/plugin/sql/key.h:155: warning: comparing floating point with == or != is unsafe
mysql5.7.11/include/plugin/sql/key.h: In member function 'rec_per_key_t st_key::records_per_key(uint) const':
mysql5.7.11/include/plugin/sql/key.h:181: warning: comparing floating point with == or != is unsafe
mysql5.7.11/include/plugin/sql/item_func.h: In member function 'virtual longlong Item_func_match::val_int()':
mysql5.7.11/include/plugin/sql/item_func.h:2395: warning: comparing floating point with == or != is unsafe
How to repeat:
Build MySQL source with gcc 4.4.7. If built without -Wno-error=float-equal then the compiler errors out.