summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>2013-09-05 09:32:56 -0500
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>2013-09-05 09:32:56 -0500
commit5430fc65a118300b35a834a1112caea3441ff12e (patch)
tree3d337987ad27362f2970e8524592c1d1244dfa96
parent4660856c6f24ed0edc04d62a5a31839cab4e5640 (diff)
downloadglibc-5430fc65a118300b35a834a1112caea3441ff12e.tar.gz
glibc-5430fc65a118300b35a834a1112caea3441ff12e.tar.xz
glibc-5430fc65a118300b35a834a1112caea3441ff12e.zip
PowerPC: fix POWER7 memrchr for some large inputs
-rw-r--r--ChangeLog6
-rw-r--r--sysdeps/powerpc/powerpc32/power7/memrchr.S4
-rw-r--r--sysdeps/powerpc/powerpc64/power7/memrchr.S4
3 files changed, 10 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 9392693742..24034639a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2013-09-05  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
 
+	* sysdeps/powerpc/powerpc32/power7/memrchr.S (__memrchr): Fix invalid
+	memory access for final bytes in some large inputs.
+	* sysdeps/powerpc/powerpc64/power7/memrchr.S (__memrchr): Likewise.
+
+2013-09-05  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
+
 	* string/test-memrchr.c: New file.
 	* string/test-memrchr-ifunc.c: New file.
 	* string/Makefile: Add new memrchr testcase.
diff --git a/sysdeps/powerpc/powerpc32/power7/memrchr.S b/sysdeps/powerpc/powerpc32/power7/memrchr.S
index d1e3fda125..defd832b0a 100644
--- a/sysdeps/powerpc/powerpc32/power7/memrchr.S
+++ b/sysdeps/powerpc/powerpc32/power7/memrchr.S
@@ -101,8 +101,8 @@ L(loop):
 	/* We're here because the counter reached 0, and that means we
 	   didn't have any matches for BYTE in the whole range.  Just return
 	   the original range.  */
-	addi	r9,r8,4
-	cmplw	cr6,r9,r7
+	addi	r8,r8,4
+	cmplw	cr6,r8,r7
 	bgt	cr6,L(loop_small)
 	b	L(null)
 
diff --git a/sysdeps/powerpc/powerpc64/power7/memrchr.S b/sysdeps/powerpc/powerpc64/power7/memrchr.S
index d24fbbb1b9..c49995210c 100644
--- a/sysdeps/powerpc/powerpc64/power7/memrchr.S
+++ b/sysdeps/powerpc/powerpc64/power7/memrchr.S
@@ -102,8 +102,8 @@ L(loop):
 	/* We're here because the counter reached 0, and that means we
 	   didn't have any matches for BYTE in the whole range.  Just return
 	   the original range.  */
-	addi	r9,r8,8
-	cmpld	cr6,r9,r7
+	addi	r8,r8,8
+	cmpld	cr6,r8,r7
 	bgt	cr6,L(loop_small)
 	b	L(null)