summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2013-08-02 13:36:25 +0400
committerAlexander Barkov <bar@mariadb.org>2013-08-02 13:36:25 +0400
commit4d15abf25a634cb5d234f22c990b7c5f06dcaffe (patch)
tree55a927d7e06d5a6dbc20121d3530e042c502ccdd /strings
parent3a1e8226e7c2de8ea9cdd752fcd156cee619acec (diff)
downloadmariadb-git-4d15abf25a634cb5d234f22c990b7c5f06dcaffe.tar.gz
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
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-ucs2.c12
1 files changed, 12 insertions, 0 deletions
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
}