Commit 2ede76c1 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-4224 : func_math test fails, when clang 3.0 compiler is used.

The reason for the problem was  negation of signed longlong value  LONGLON
G_MIN in  Item_func_neg::int_op() - the result of this operation is not defined
(in C/C++ standard).

With this patch, LONGLONG_MIN is handled as special value, and negation is
avoided.
parent 806e6cda
......@@ -1907,6 +1907,14 @@ longlong Item_func_neg::int_op()
if (args[0]->unsigned_flag &&
(ulonglong) value > (ulonglong) LONGLONG_MAX + 1)
return raise_integer_overflow();
if (value == LONGLONG_MIN)
if (args[0]->unsigned_flag != unsigned_flag)
/* negation of LONGLONG_MIN is LONGLONG_MIN. */
return LONGLONG_MIN;
else
return raise_integer_overflow();
return check_integer_overflow(-value, !args[0]->unsigned_flag && value < 0);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment