Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
3.0.4
-
None
-
None
-
PPC64/ PPC64LE
Description
The compile warning on Power and other architectures that defines char to be unsigned (which is allowed by C standard) causes there to be no error handling.
In this case the SOCKET_ERROR (-1) is never true.
plugins/pvio/pvio_socket.c:763:42: warning: comparison of constant -1 with expression of type 'my_bool' (aka 'char') is always
|
false [-Wtautological-constant-out-of-range-compare]
|
if (pvio_socket_blocking(pvio, 1, 0) == SOCKET_ERROR)
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
|
plugins/pvio/pvio_socket.c:875:46: warning: comparison of constant -1 with expression of type 'my_bool' (aka 'char') is always
|
false [-Wtautological-constant-out-of-range-compare]
|
if (pvio_socket_blocking(pvio, 0, 0) == SOCKET_ERROR)
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
|
plugins/pvio/pvio_socket.c:907:42: warning: comparison of constant -1 with expression of type 'my_bool' (aka 'char') is always
|
false [-Wtautological-constant-out-of-range-compare]
|
if (pvio_socket_blocking(pvio, 1, 0) == SOCKET_ERROR)
|
warnings (from ppc64 RHEL / gcc 4.8.5):
/home/ozlabs/mariadb-server/libmariadb/libmariadb/ma_tls.c: In function ‘ma_pvio_tls_compare_fp’:
|
/home/ozlabs/mariadb-server/libmariadb/libmariadb/ma_tls.c:169:5: warning: comparison is always false due to limited range of data type [-Wtype-limits]
|
if ((d1 = ma_hex2int(*p)) == - 1 ||
|
^
|
/home/ozlabs/mariadb-server/libmariadb/libmariadb/ma_tls.c:170:9: warning: comparison is always false due to limited range of data type [-Wtype-limits]
|
(d2 = ma_hex2int(*(p+1))) == -1 ||
|
^
|
Fix:
https://github.com/MariaDB/mariadb-connector-c/pull/49
By being explicit about using signed char when negative values are used it creates a consistent API with x86_64 which is signed by default. PR also changes some times to void suspicious casting.