[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commits] r25464 - in /fsf/glibc-2_18-branch/libc: ChangeLog NEWS string/test-strcmp.c sysdeps/sparc/sparc64/strcmp.S



Author: eglibc
Date: Fri May  2 00:05:32 2014
New Revision: 25464

Log:
Import glibc-2.18 for 2014-05-02

Modified:
    fsf/glibc-2_18-branch/libc/ChangeLog
    fsf/glibc-2_18-branch/libc/NEWS
    fsf/glibc-2_18-branch/libc/string/test-strcmp.c
    fsf/glibc-2_18-branch/libc/sysdeps/sparc/sparc64/strcmp.S

Modified: fsf/glibc-2_18-branch/libc/ChangeLog
==============================================================================
--- fsf/glibc-2_18-branch/libc/ChangeLog (original)
+++ fsf/glibc-2_18-branch/libc/ChangeLog Fri May  2 00:05:32 2014
@@ -1,3 +1,13 @@
+2014-05-01  David S. Miller  <davem@xxxxxxxxxxxxx>
+
+	[BZ #16885]
+	* sysdeps/sparc/sparc64/strcmp.S: Fix end comparison handling when
+	multiple zero bytes exist at the end of a string.
+	Reported by Aurelien Jarno <aurelien@xxxxxxxxxxx>
+
+	* string/test-strcmp.c (check): Add explicit test for situations where
+	there are multiple zero bytes after the first.
+
 2014-01-29  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
 
 	[BZ #16510]

Modified: fsf/glibc-2_18-branch/libc/NEWS
==============================================================================
--- fsf/glibc-2_18-branch/libc/NEWS (original)
+++ fsf/glibc-2_18-branch/libc/NEWS Fri May  2 00:05:32 2014
@@ -9,7 +9,7 @@
 
 * The following bugs are resolved with this release:
 
-  15073, 15128, 15909, 15996, 16150, 16169, 16387, 16510.
+  15073, 15128, 15909, 15996, 16150, 16169, 16387, 16510, 16885.
 
 Version 2.18
 

Modified: fsf/glibc-2_18-branch/libc/string/test-strcmp.c
==============================================================================
--- fsf/glibc-2_18-branch/libc/string/test-strcmp.c (original)
+++ fsf/glibc-2_18-branch/libc/string/test-strcmp.c Fri May  2 00:05:32 2014
@@ -329,6 +329,34 @@
 		FOR_EACH_IMPL (impl, 0)
 		check_result (impl, s1 + i1, s2 + i2, exp_result);
       }
+
+  /* Test cases where there are multiple zero bytes after the first.  */
+
+  for (size_t i = 0; i < 16 + 1; i++)
+    {
+      s1[i] = 0x00;
+      s2[i] = 0x00;
+    }
+
+  for (size_t i = 0; i < 16; i++)
+    {
+      int exp_result;
+
+      for (int val = 0x01; val < 0x100; val++)
+	{
+	  for (size_t j = 0; j < i; j++)
+	    {
+	      s1[j] = val;
+	      s2[j] = val;
+	    }
+
+	  s2[i] = val;
+
+	  exp_result = SIMPLE_STRCMP (s1, s2);
+	  FOR_EACH_IMPL (impl, 0)
+	    check_result (impl, s1, s2, exp_result);
+	}
+    }
 }
 
 

Modified: fsf/glibc-2_18-branch/libc/sysdeps/sparc/sparc64/strcmp.S
==============================================================================
--- fsf/glibc-2_18-branch/libc/sysdeps/sparc/sparc64/strcmp.S (original)
+++ fsf/glibc-2_18-branch/libc/sysdeps/sparc/sparc64/strcmp.S Fri May  2 00:05:32 2014
@@ -121,6 +121,37 @@
 	movleu	%xcc, -1, %o0
 	srlx	rTMP1, 7, rTMP1
 
+	/* In order not to be influenced by bytes after the zero byte, we
+	 * have to retain only the highest bit in the mask for the comparison
+	 * with rSTRXOR to work properly.
+	 */
+	mov	0, rTMP2
+	andcc	rTMP1, 0x0100, %g0
+
+	movne	%xcc, 8, rTMP2
+	sllx	rTMP1, 63 - 16, %o1
+
+	movrlz	%o1, 16, rTMP2
+	sllx	rTMP1, 63 - 24, %o1
+
+	movrlz	%o1, 24, rTMP2
+	sllx	rTMP1, 63 - 32, %o1
+
+	movrlz	%o1, 32, rTMP2
+	sllx	rTMP1, 63 - 40, %o1
+
+	movrlz	%o1, 40, rTMP2
+	sllx	rTMP1, 63 - 48, %o1
+
+	movrlz	%o1, 48, rTMP2
+	sllx	rTMP1, 63 - 56, %o1
+
+	movrlz	%o1, 56, rTMP2
+
+	srlx	rTMP1, rTMP2, rTMP1
+
+	sllx	rTMP1, rTMP2, rTMP1
+
 	cmp	rTMP1, rSTRXOR
 	retl
 	 movgu	%xcc, 0, %o0

_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits