From 5c04a99e2afda8c6fddb2572cd6f9e975aa52238 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 28 Sep 2007 22:35:48 +0200 Subject: [PATCH 1/2] ctype-simple.c: Avoid undefined value when negating (bug#30069) strings/ctype-simple.c: Avoid undefined value when negating (bug#30069) --- strings/ctype-simple.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index ccdfb5936b7..0355803daa8 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -802,7 +802,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; @@ -838,7 +838,7 @@ int my_longlong10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), { if (val < 0) { - val = -val; + val = -(ulonglong)val; *dst++= '-'; len--; sign= 1; From 568f624406fb6771f5815bbe6184de6909270488 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Nov 2007 12:52:03 +0100 Subject: [PATCH 2/2] bigint.test, bigint.result: Test case for Bug#30069 mysql-test/r/bigint.result: Test case for Bug#30069 mysql-test/t/bigint.test: Test case for Bug#30069 --- mysql-test/r/bigint.result | 6 ++++++ mysql-test/t/bigint.test | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index e9a457c9dfa..a73342e1f7d 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -135,3 +135,9 @@ 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; diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 8a238d33e08..e5cd70209ea 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -107,4 +107,13 @@ 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