Navigation Menu

Skip to content

Commit

Permalink
i386 multiple column index: disable optimization
Browse files Browse the repository at this point in the history
Those tests are failed with gcc 4.1.2 -O2 on CentOS 5.8 i686:
  mroonga_storage.multiple_column_index_select_double
  mroonga_storage.multiple_column_index_select_float

We need to disable optimization by volatile.

Reported by Kazuhiko Shiozaki. Thanks!!!
  • Loading branch information
kou committed Mar 18, 2012
1 parent 2095818 commit f22888f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ha_mroonga.cc
Expand Up @@ -8879,10 +8879,10 @@ int ha_mroonga::storage_encode_multiple_column_key(KEY *key_info,
TYPE_BYTE_SEQUENCE
} data_type = TYPE_UNKNOWN;
uint32 data_size = 0;
int int_value = 0;
long long int long_long_value = 0;
float float_value = 0.0;
double double_value = 0.0;
volatile int int_value = 0;
volatile long long int long_long_value = 0;
volatile float float_value = 0.0;
volatile double double_value = 0.0;
switch (field->real_type()) {
case MYSQL_TYPE_DECIMAL:
data_type = TYPE_BYTE_SEQUENCE;
Expand Down Expand Up @@ -9053,7 +9053,9 @@ int ha_mroonga::storage_encode_multiple_column_key(KEY *key_info,
case TYPE_DOUBLE:
{
int n_bits = (data_size * 8 - 1);
long_long_value = *((long long int *)(&double_value));
volatile long long int *encoded_value_pointer =
(long long int *)(&double_value);
long_long_value = *encoded_value_pointer;
if (!decode)
long_long_value ^= ((long_long_value >> n_bits) | (1LL << n_bits));
mrn_byte_order_host_to_network(current_buffer, &long_long_value,
Expand Down

4 comments on commit f22888f

@fdiary
Copy link
Member

@fdiary fdiary commented on f22888f Mar 18, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この変更で、gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) でエラーになるようになりました。

ha_mroonga.cc: In member function ‘int ha_mroonga::storage_encode_multiple_column_key(KEY*, const uchar*, uint, uchar*, uint*, bool)’:
ha_mroonga.cc:8906:56: error: invalid conversion from ‘volatile void*’ to ‘void*’ [-fpermissive]
/usr/include/x86_64-linux-gnu/bits/string3.h:49:1: error:   initializing argument 1 of ‘void* memcpy(void*, const void*, size_t)’ [-fpermissive]
ha_mroonga.cc:8911:62: error: invalid conversion from ‘volatile void*’ to ‘void*’ [-fpermissive]
/usr/include/x86_64-linux-gnu/bits/string3.h:49:1: error:   initializing argument 1 of ‘void* memcpy(void*, const void*, size_t)’ [-fpermissive]

@kou
Copy link
Member Author

@kou kou commented on f22888f Mar 18, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

知ってます!

@fdiary
Copy link
Member

@fdiary fdiary commented on f22888f Mar 18, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

もうなおっていた! さすが手が早い!

@kou
Copy link
Member Author

@kou kou commented on f22888f Mar 18, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

でも、元の問題は再発です!

Please sign in to comment.