Commit 48a2c3ee authored by Tor Didriksen's avatar Tor Didriksen

Bug#13463415 followup: compensate for compiler bug

parent 57a10198
...@@ -7399,9 +7399,13 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item) ...@@ -7399,9 +7399,13 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
or less than the original Item. A 0 may also be returned if or less than the original Item. A 0 may also be returned if
out of memory. out of memory.
@note We only use this on the range optimizer/partition pruning, @note We use this in the range optimizer/partition pruning,
because in some cases we can't store the value in the field because in some cases we can't store the value in the field
without some precision/character loss. without some precision/character loss.
We similarly use it to verify that expressions like
BIGINT_FIELD <cmp> <literal value>
is done correctly (as int/decimal/float according to literal type).
*/ */
int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
...@@ -7459,10 +7463,15 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) ...@@ -7459,10 +7463,15 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
field_val= field->val_decimal(&field_buf); field_val= field->val_decimal(&field_buf);
return my_decimal_cmp(item_val, field_val); return my_decimal_cmp(item_val, field_val);
} }
double result= item->val_real(); /*
The patch for Bug#13463415 started using this function for comparing
BIGINTs. That uncovered a bug in Visual Studio 32bit optimized mode.
Prefixing the auto variables with volatile fixes the problem....
*/
volatile double result= item->val_real();
if (item->null_value) if (item->null_value)
return 0; return 0;
double field_result= field->val_real(); volatile double field_result= field->val_real();
if (field_result < result) if (field_result < result)
return -1; return -1;
else if (field_result > result) else if (field_result > result)
......
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