about summary refs log tree commit diff
path: root/string/test-memcmp.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-04-11 22:11:44 +0000
committerRoland McGrath <roland@gnu.org>2003-04-11 22:11:44 +0000
commit9fb0cae85c1266abff645b831b7070113c89d0aa (patch)
tree7d1f1220534f31e7bb854f3c2a46e7122a377928 /string/test-memcmp.c
parentb35fce97f8d4a2963af866cb4801245d0f47d3ac (diff)
downloadglibc-9fb0cae85c1266abff645b831b7070113c89d0aa.tar.gz
glibc-9fb0cae85c1266abff645b831b7070113c89d0aa.tar.xz
glibc-9fb0cae85c1266abff645b831b7070113c89d0aa.zip
* string/test-strcmp.c (do_random_tests): Test whether return value
	has been promoted to wordsize if the ABI requires caller to do so.
	* string/test-strncmp.c (do_random_tests): Likewise.
	* string/test-memcmp.c (do_random_tests): Likewise.

	* sysdeps/powerpc/powerpc64/strcmp.S (strcmp): Sign extend rRTN
	before returning.
Diffstat (limited to 'string/test-memcmp.c')
-rw-r--r--string/test-memcmp.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/string/test-memcmp.c b/string/test-memcmp.c
index d3cc560470..4d38ddbf6a 100644
--- a/string/test-memcmp.c
+++ b/string/test-memcmp.c
@@ -1,5 +1,5 @@
 /* Test and measure memcmp functions.
-   Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -110,7 +110,8 @@ static void
 do_random_tests (void)
 {
   size_t i, j, n, align1, align2, pos, len;
-  int result, r;
+  int result;
+  long r;
   unsigned char *p1 = buf1 + page_size - 512;
   unsigned char *p2 = buf2 + page_size - 512;
 
@@ -159,11 +160,14 @@ do_random_tests (void)
       FOR_EACH_IMPL (impl, 1)
 	{
 	  r = CALL (impl, p1 + align1, p2 + align2, len);
+	  /* Test whether on 64-bit architectures where ABI requires
+	     callee to promote has the promotion been done.  */
+	  asm ("" : "=g" (r) : "0" (r));
 	  if ((r == 0 && result)
 	      || (r < 0 && result >= 0)
 	      || (r > 0 && result <= 0))
 	    {
-	      error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd, %zd) %d != %d, p1 %p p2 %p",
+	      error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd, %zd) %ld != %d, p1 %p p2 %p",
 		     n, impl->name, align1, align2, len, pos, r, result, p1, p2);
 	      ret = 1;
 	    }