diff options
-rw-r--r-- | mysql-test/r/bigint.result | 6 | ||||
-rw-r--r-- | mysql-test/t/bigint.test | 9 | ||||
-rw-r--r-- | strings/ctype-simple.c | 4 |
3 files changed, 17 insertions, 2 deletions
diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index 064304b27aa..b0d114f1655 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -170,6 +170,12 @@ t2.value64=t1.value64; value64 value32 value64 value32 9223372036854775807 2 9223372036854775807 4 drop table t1, t2; +create table t1 (sint64 bigint not null); +insert into t1 values (-9223372036854775808); +select * from t1; +sint64 +-9223372036854775808 +drop table t1; create table t1 select 1 as 'a'; show create table t1; Table Create Table diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 002dfad9981..f96350686af 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -113,6 +113,15 @@ t2.value64=t1.value64; drop table t1, t2; +# Test for BUG#30069, can't handle bigint -9223372036854775808 on +# x86_64, with some GCC versions and optimizations. + +create table t1 (sint64 bigint not null); +insert into t1 values (-9223372036854775808); +select * from t1; + +drop table t1; + # End of 4.1 tests # diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index 8b1b0d6790d..9f5c993dfa0 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -845,7 +845,7 @@ int my_long10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), { if (val < 0) { - val= -val; + val= -(unsigned long int)val; *dst++= '-'; len--; sign= 1; @@ -881,7 +881,7 @@ int my_longlong10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), { if (val < 0) { - val = -val; + val = -(ulonglong)val; *dst++= '-'; len--; sign= 1; |