diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2019-06-07 11:41:18 +0200 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2019-06-11 06:58:00 +0200 |
commit | 40ff8019d2a00071f533bb3210b4d3a552e95bc8 (patch) | |
tree | 103f542480d5d255c9ec725578debbe32d0a9c2f /sql/sql_bitmap.h | |
parent | be5c432a42eed10535354f31dfd6daa07095e555 (diff) | |
download | mariadb-git-40ff8019d2a00071f533bb3210b4d3a552e95bc8.tar.gz |
MDEV-19709 Bitmap<128>::merge etc may crash on older GCC versions
Older GCC generates SSE instruction on not-128-bit-aligned data in
Bitmap<128>::buffer
Workaround by forcing GCC not to use SSE on Bitmap<N> template.
Diffstat (limited to 'sql/sql_bitmap.h')
-rw-r--r-- | sql/sql_bitmap.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h index 93c5056a8fb..4f1acb60161 100644 --- a/sql/sql_bitmap.h +++ b/sql/sql_bitmap.h @@ -27,6 +27,18 @@ #include <my_bitmap.h> #include <my_bit.h> +/* + Workaround GCC optimizer bug (generating SSE instuctions on unaligned data) +*/ +#if defined (__GNUC__) && defined(__x86_64__) && (__GNUC__ < 6) +#define NEED_GCC_NO_SSE_WORKAROUND +#endif + +#ifdef NEED_GCC_NO_SSE_WORKAROUND +#pragma GCC push_options +#pragma GCC target ("no-sse") +#endif + template <uint width> class Bitmap { uint32 buffer[(width + 31) / 32]; @@ -266,6 +278,11 @@ public: }; }; +#ifdef NEED_GCC_NO_SSE_WORKAROUND +#pragma GCC pop_options +#undef NEED_GCC_NO_SSE_WORKAROUND +#endif + /* An iterator to quickly walk over bits in ulonglong bitmap. */ class Table_map_iterator { |