Bug #87543 dd_sdi-t.cc assumes 'char' to be signed
Submitted: 25 Aug 2017 11:30 Modified: 9 Nov 2017 13:21
Reporter: Alexey Kopytov Email Updates:
Status: Closed Impact on me:
None 
Category:Tests: Server Severity:S3 (Non-critical)
Version:8.0.2 OS:Any
Assigned to: CPU Architecture:Any

[25 Aug 2017 11:30] Alexey Kopytov
Description:
There is a new unit test in MySQL 8.0 which is broken on AArch64 (and
likely on POWER too), because it assumes the 'char' data type to be
signed. In unittest/gunit/dd_sdi-t.cc:

518  char x= 127;
...
528  unsigned char tmp= 0xe0;
529  x= static_cast<char>(tmp);
530  EXPECT_EQ(-32,x);

I.e. it expects 0xe0 to wrap around after casting it to 'char'. Which is
not the case on architectures where 'char' is unsigned by default. So
the above check and a few subsequent ones fail.

How to repeat:
- look at the code
or
- run that unit test on an AArch64 or POWER machine
or
- build the server with CXXFLAGS="-funsigned-char" on x86 and run the test

Suggested fix:
Replace 'char' with 'signed char' in the CharPromotion test in dd_sdi-t.cc
[25 Aug 2017 13:51] OCA Admin
Contribution submitted via Github - Bug #87543: dd_sdi-t.cc assumes 'char' to be signed 
(*) Contribution by Alexey Kopytov (Github akopytov, mysql-server/pull/169#issuecomment-324896883): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: git_patch_137654858.txt (text/plain), 934 bytes.

[27 Aug 2017 6:16] Umesh Shastry
Hello Alexey,

Thank you for the report and contribution.

Thanks,
Umesh
[9 Nov 2017 13:21] Erlend Dahl
This was fixed in 8.0.3.