Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.2(EOL)
-
clang 3.9, 4.0, 5.0
Description
As discovered on travis, clang test (simplified as below fail).
Simplified test
create table t1 ( A_Id bigint(20) NOT NULL default '0', A_UpdateBy char(10) NOT NULL default '', A_UpdateDate bigint(20) NOT NULL default '0', A_UpdateSerial int(11) NOT NULL default '0', other_types bigint(20) NOT NULL default '0', wss_type bigint(20) NOT NULL default '0');
|
INSERT INTO t1 VALUES (102935998719055004,'brade',1029359987,2,102935229116544068,102935229216544093);
|
select wss_type from t1 where wss_type ='102935229216544093';
|
This returns no results.
As discovered with cvicentiu, the error manifests in stored_field_cmp_to_item.
item_cmp_type returns a common factor of REAL between string and INT types and therefore adopts a double based equality test at the end of the stored_field_cmp_to_item function.
Unfortunately the results for the conversion from the ulonglong in item->val_real() and field->val_real() differ by ~80 resulting in no equally and the SQL statement returning the wrong result.
Options include:
a) pushing an error when users quote numbers in queries - probably too common
b) fix this such that where this string is meticulously parsed in my_strntoull10rnd_8bit, b1) the ability to convert this to an integer is determined. Special cases? exponents detected (these are tested that it still falls < CUTOFF so no action taken b2) large -ve exponents are rounded to 0. b3) Decimals are rounded (handle to DECIMAL type).
c) fudge the test case until it pops up again
On 10.2 branch at f59a1826f81e3246735c2ca61daec794170b61d1
fails:
$ clang --version
clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
(from: clang-4.0.1-5.fc26.src.rpm)
fails:
clang version 5.0.0 (git://gitlab.ozlabs.ibm.com/mirror/llvm-clang.git 79a6eca386d468058b31e2d4f54b1b736a12f558) (git://gitlab.ozlabs.ibm.com/mirror/llvm.git 31f450353208e4d108fff264a2eba433758a0709)
circa march 2017 (https://github.com/llvm-mirror/clang/commit/79a6eca386d468058b31e2d4f54b1b736a12f558). Git commits correspond to upstream git mirror.
(cd mysql-test/; ./mtr test)
clang version 5.0.0 (git://gitlab.ozlabs.ibm.com/mirror/llvm-clang.git 79a6eca386d468058b31e2d4f54b1b736a12f558) (git://gitlab.ozlabs.ibm.com/mirror/llvm.git 31f450353208e4d108fff264a2eba433758a0709)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/dan/clang/bin
Logging: /home/dan/repos/mariadb-server/mysql-test/mysql-test-run.pl test
vardir: /home/dan/repos/build-mariadb-10.2-clang-5.0/mysql-test/var
Checking leftover processes...
Removing old var directory...
Creating var directory '/home/dan/repos/build-mariadb-10.2-clang-5.0/mysql-test/var'...
Checking supported features...
MariaDB Version 10.2.12-MariaDB
- SSL connections supported
Collecting tests...
Installing system database...
==============================================================================
TEST RESULT TIME (ms) or COMMENT
--------------------------------------------------------------------------
worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
create table t1 ( A_Id bigint(20) NOT NULL default '0', A_UpdateBy char(10) NOT NULL default '', A_UpdateDate bigint(20) NOT NULL default '0', A_UpdateSerial int(11) NOT NULL default '0', other_types bigint(20) NOT NULL default '0', wss_type bigint(20) NOT NULL default '0');
INSERT INTO t1 VALUES (102935998719055004,'brade',1029359987,2,102935229116544068,102935229216544093);
select wss_type from t1 where wss_type ='102935229216544093';
wss_type
SHOW WARNINGS;
Level Code Message
select wss_type from t1 where wss_type =0x16DB30BAC53555D;
wss_type
102935229216544093
SHOW WARNINGS;
Level Code Message
select wss_type from t1 where wss_type =102935229216544093;
wss_type
102935229216544093
works: clang-6.0 from November 2017
$ /home/dan/clang-6.0/bin/clang++ --version && (cd mysql-test/; ./mtr select)
/home/dan/clang-6.0/bin/clang++: /lib64/libtinfo.so.5: no version information available (required by /home/dan/clang-6.0/bin/clang++)
clang version 6.0.0 (git://gitlab.ozlabs.ibm.com/mirror/llvm-clang.git 24008b27d5f4c12c43f88e6f4037f16ec43a8bc3) (git://gitlab.ozlabs.ibm.com/mirror/llvm.git 0d7d3a3c3255f9bafe37485d33262aa10ef8f29f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/dan/clang-6.0/bin
Logging: /home/dan/repos/mariadb-server/mysql-test/mysql-test-run.pl select
vardir: /home/dan/repos/build-mariadb-10.2-clang-6.0/mysql-test/var
Checking leftover processes...
Removing old var directory...
Creating var directory '/home/dan/repos/build-mariadb-10.2-clang-6.0/mysql-test/var'...
Checking supported features...
MariaDB Version 10.2.12-MariaDB
- SSL connections supported
Collecting tests...
Installing system database...
==============================================================================
TEST RESULT TIME (ms) or COMMENT
--------------------------------------------------------------------------
worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
main.select [ pass ] 1708
--------------------------------------------------------------------------
The servers were restarted 0 times
Spent 1.708 of 5 seconds executing testcases
Completed: All 1 tests were successful.