Bug #81295 main.bigint/rpl.rpl_stm_user_variables fail on Ubuntu 15.10 Wily in release mode
Submitted: 3 May 2016 13:35 Modified: 3 May 2016 16:10
Reporter: Yura Sorokin (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Data Types Severity:S3 (Non-critical)
Version:5.5.49 OS:Ubuntu (15.10 (Wily))
Assigned to: CPU Architecture:Any

[3 May 2016 13:35] Yura Sorokin
Description:
main.bigint and rpl.rpl_stm_user_variables fail in MySQL Server 5.5.49 on Ubuntu 15.10 (Wily) (both 32- and 64-bit) in release mode.

The problem seems to appear when GCC > 5.0 is used for release builds.

Related 5.6 bug:
https://bugs.mysql.com/bug.php?id=76654

CURRENT_TEST: main.bigint
--- /home/yura/ws/mysql-server/mysql-test/r/bigint.result       2016-05-02 20:34:52.661957288 +0300
+++ /home/yura/ws/mysql-server/mysql-test/r/bigint.reject       2016-05-03 16:12:08.203767711 +0300
@@ -385,15 +385,15 @@
 -9223372036854775808
 select -(-(9223372036854775808));
 Catalog        Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null  Flags   Decimals        Charsetnr
-def                                    -(-(9223372036854775808))       246     21      19      N       32897   063
+def                                    -(-(9223372036854775808))       246     21      9       N       32897   063
 -(-(9223372036854775808))
-9223372036854775808
+854775808
 select --9223372036854775808, ---9223372036854775808, ----9223372036854775808;
 --9223372036854775808  ---9223372036854775808  ----9223372036854775808
-9223372036854775808    -9223372036854775808    9223372036854775808
+854775808      -854775808      854775808
 select -(-9223372036854775808), -(-(-9223372036854775808));
 -(-9223372036854775808)        -(-(-9223372036854775808))
-9223372036854775808    -9223372036854775808
+854775808      -854775808
 create table t1 select -9223372036854775808 bi;
 describe t1;
 Field  Type    Null    Key     Default Extra

mysqltest: Result content mismatch

CURRENT_TEST: rpl.rpl_stm_user_variables
--- /home/yura/ws/mysql-server/mysql-test/suite/rpl/r/rpl_stm_user_variables.result     2016-05-02 20:34:53.509861681 +0300
+++ /home/yura/ws/mysql-server/mysql-test/suite/rpl/r/rpl_stm_user_variables.reject     2016-05-03 16:32:33.026299276 +0300
@@ -127,7 +127,7 @@
 double -9.223372036854776e18
 float  -9.22337e18
 real   -9223372036854776000.00
-decimal        -9223372036854775808.00
+decimal        -854775808.00
 #### [ on slave ]
 SELECT * FROM t1;
 tinyint        -128
@@ -143,7 +143,7 @@
 double -9.223372036854776e18
 float  -9.22337e18
 real   -9223372036854776000.00
-decimal        -9223372036854775808.00
+decimal        -854775808.00
 #########################################
 ## assertion: master and slave tables are in sync
 include/diff_tables.inc [master:t1,slave:t1]
@@ -179,7 +179,7 @@
 double -9.223372036854776e18
 float  -9.22337e18
 real   -9223372036854776000.00
-decimal        -9223372036854775808.00
+decimal        -854775808.00
 #### [ on slave ]
 SELECT * FROM t1;
 tinyint        -128
@@ -195,7 +195,7 @@
 double -9.223372036854776e18
 float  -9.22337e18
 real   -9223372036854776000.00
-decimal        -9223372036854775808.00
+decimal        -854775808.00
 #########################################
 ## assertion: master and slave tables are in sync
 include/diff_tables.inc [master:t1,slave:t1]

mysqltest: Result content mismatch

How to repeat:
git clone -b 5.5 https://github.com/mysql/mysql-server.git
mkdir mysql-server-build-5.5
cd mysql-server-build-5.5
cmake \
 ../mysql-server \
 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
 -DBUILD_CONFIG=mysql_release \
 -DFEATURE_SET=community \
 -DWITH_EMBEDDED_SERVER=OFF \
 -DENABLE_DTRACE=OFF \
 -DWITH_EXAMPLE_STORAGE_ENGINE=ON \
 -DWITH_SSL=system
make -j4

./mysql-test/mtr main.bigint
./mysql-test/mtr rpl.rpl_stm_user_variables

Suggested fix:
Backport the fix from 5.6

commit 49329220ea0f40e42344cef39b0d9b72bd5f557f
Author: Tor Didriksen <tor.didriksen@oracle.com>
Date:   Wed Apr 8 16:53:55 2015 +0200

    Bug#20768820 MAIN.BIGINT TEST FAILS WHEN BUILT WITH GCC 5 IN RELEASE BUILD
    
    Problem: with gcc5 in optmized mode, (- LLONG_MIN ) yields integer overflow.
    Fix: In ull2dec() change the loop which counts the number of decimal_digit_t's
    (cherry picked from commit b37d8bcc24f82f8e15c5f6e2243c8937af74acb7)
[3 May 2016 16:08] MySQL Verification Team
test results

Attachment: test_bug81295.txt (text/plain), 6.49 KiB.

[3 May 2016 16:10] MySQL Verification Team
Thank you for the bug report.