Description:
Some MySQL source code assumes the C/C++ "char" data type is signed, yet the Makefiles do not append the -fsigned-char option when using gcc.
For compatibility with other, older C compilers on the Stratus VOS operating system, our port of gcc defaults to unsigned chars. We tracked down a failure in the main.outfile_loaddata self-test to some code in sql/sql_load.cc, in the READ_INFO::terminator subroutine, that fails when MySQL is built using unsigned characters. When we added the -fsigned-char option, the problems cleared up. We did not attempt to discover the exact problem with the code in READ_INFO::terminator; we took the easier route and changed the compilation options.
An earlier port of MySQL 5.0.75 to the same operating system and same version of gcc did not exhibit this erroneous behavior.
I have verified that the READ_INFO::terminator subroutine in sql_load.cc is unchanged in MySQL 5.6.2-m5. I have not tried building MySQL 5.6.2-m5 to see if this issue is otherwise corrected; hence, I have tagged this bug report against 5.1.48. I took a peek at the CMake files distributed with 5.6.2-m5, but I don't see any references to -fsigned-char, so I rather suspect that this issue still exists in the current version.
For the record, this problem arose using GCC 3.4.6 on Stratus OpenVOS Release 17.1.
How to repeat:
You should be able to reproduce this issue by adding the -funsigned-char option to CFLAGS and CXXFLAGS.
Suggested fix:
I solved my problem by adding -fsigned-char to CFLAGS and CXXFLAGS. But I would prefer that MySQL not have any code in it that depends upon the signed quality of chars.
I have not supplied a patch, because I made changes to our build environment, rather than to any files in MySQL.