mirror of
https://github.com/MariaDB/server.git
synced 2025-12-06 05:42:06 +03:00
Bug#13463415 followup: compensate for compiler bug
This commit is contained in:
15
sql/item.cc
15
sql/item.cc
@@ -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
|
||||
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
|
||||
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)
|
||||
@@ -7459,10 +7463,15 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
|
||||
field_val= field->val_decimal(&field_buf);
|
||||
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)
|
||||
return 0;
|
||||
double field_result= field->val_real();
|
||||
volatile double field_result= field->val_real();
|
||||
if (field_result < result)
|
||||
return -1;
|
||||
else if (field_result > result)
|
||||
|
||||
Reference in New Issue
Block a user