Skip to content

Commit ac61a57

Browse files
committed
Revert "Remove use of volatile in stored_field_cmp_to_item"
This reverts commit 7603463. The commit itself is fine, however when disabling volatile, compiler optimizations mess up our double results due to precision differences. Revert the patch till a proper solution is found.
1 parent 7603463 commit ac61a57

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

sql/item.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8924,10 +8924,15 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
89248924
}
89258925
return my_time_compare(&field_time, &item_time);
89268926
}
8927-
double result= item->val_real();
8927+
/*
8928+
The patch for Bug#13463415 started using this function for comparing
8929+
BIGINTs. That uncovered a bug in Visual Studio 32bit optimized mode.
8930+
Prefixing the auto variables with volatile fixes the problem....
8931+
*/
8932+
volatile double result= item->val_real();
89288933
if (item->null_value)
89298934
return 0;
8930-
double field_result= field->val_real();
8935+
volatile double field_result= field->val_real();
89318936
if (field_result < result)
89328937
return -1;
89338938
else if (field_result > result)

0 commit comments

Comments
 (0)