From 4d15abf25a634cb5d234f22c990b7c5f06dcaffe Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 2 Aug 2013 13:36:25 +0400 Subject: 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 --- strings/ctype-ucs2.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'strings') diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index b23b88a165d..26f15584bcd 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -3033,11 +3033,23 @@ static void my_fill_ucs2(CHARSET_INFO *cs __attribute__((unused)), 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; uint16 tmp= (fill >> 8) + ((fill & 0xFF) << 8); /* swap bytes */ DBUG_ASSERT(fill <= 0xFFFF); for ( ; s <= last; s+= 2) int2store(s, tmp); /* store little-endian */ +#else + for ( ; l >= 2; s[0]= (fill >> 8), s[1]= (fill & 0xFF), s+= 2, l-= 2); +#endif } -- cgit v1.2.1