Commit 4d15abf2 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-4786 merge 10.0-monty > 10.0

Workaround for a possible GCC bug happening in my_fill_ucs2:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58039

Commenting out the optimized loop.
Using the original MySQL version.

modified:
  strings/ctype-ucs2.c
parent 3a1e8226
...@@ -3033,11 +3033,23 @@ static void ...@@ -3033,11 +3033,23 @@ static void
my_fill_ucs2(CHARSET_INFO *cs __attribute__((unused)), my_fill_ucs2(CHARSET_INFO *cs __attribute__((unused)),
char *s, size_t l, int fill) char *s, size_t l, int fill)
{ {
DBUG_ASSERT(fill <= 0xFFFF);
#ifdef WAITING_FOR_GCC_VECTORIZATION_BUG_TO_BE_FIXED
/*
This code with int2store() is known to be faster on some processors,
but crashes on other processors due to a possible bug in GCC's
-ftree-vectorization (which is enabled in -O3) in case of
a non-aligned memory. See here for details:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58039
*/
char *last= s + l - 2; char *last= s + l - 2;
uint16 tmp= (fill >> 8) + ((fill & 0xFF) << 8); /* swap bytes */ uint16 tmp= (fill >> 8) + ((fill & 0xFF) << 8); /* swap bytes */
DBUG_ASSERT(fill <= 0xFFFF); DBUG_ASSERT(fill <= 0xFFFF);
for ( ; s <= last; s+= 2) for ( ; s <= last; s+= 2)
int2store(s, tmp); /* store little-endian */ int2store(s, tmp); /* store little-endian */
#else
for ( ; l >= 2; s[0]= (fill >> 8), s[1]= (fill & 0xFF), s+= 2, l-= 2);
#endif
} }
......
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