Commit f3940eba authored by unknown's avatar unknown

Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt

into  magare.gmz:/home/kgeorge/mysql/autopush/B28400-5.0-opt

parents e434a5ca fe036d98
...@@ -3663,33 +3663,38 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, ...@@ -3663,33 +3663,38 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
case MYSQL_TYPE_FLOAT: case MYSQL_TYPE_FLOAT:
{ {
/* /*
We need to store data in the buffer before the truncation check to We need to mark the local variable volatile to
workaround Intel FPU executive precision feature. workaround Intel FPU executive precision feature.
(See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 for details) (See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 for details)
AFAIU it does not guarantee to work.
*/ */
float data; volatile float data;
if (is_unsigned) if (is_unsigned)
{
data= (float) ulonglong2double(value); data= (float) ulonglong2double(value);
*param->error= ((ulonglong) value) != ((ulonglong) data);
}
else else
data= (float) value; {
data= (float)value;
*param->error= value != ((longlong) data);
}
floatstore(buffer, data); floatstore(buffer, data);
*param->error= is_unsigned ?
((ulonglong) value) != ((ulonglong) (*(float*) buffer)) :
((longlong) value) != ((longlong) (*(float*) buffer));
break; break;
} }
case MYSQL_TYPE_DOUBLE: case MYSQL_TYPE_DOUBLE:
{ {
double data; volatile double data;
if (is_unsigned) if (is_unsigned)
{
data= ulonglong2double(value); data= ulonglong2double(value);
*param->error= ((ulonglong) value) != ((ulonglong) data);
}
else else
{
data= (double)value; data= (double)value;
*param->error= value != ((longlong) data);
}
doublestore(buffer, data); doublestore(buffer, data);
*param->error= is_unsigned ?
((ulonglong) value) != ((ulonglong) (*(double*) buffer)) :
((longlong) value) != ((longlong) (*(double*) buffer));
break; break;
} }
case MYSQL_TYPE_TIME: case MYSQL_TYPE_TIME:
......
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