about summary refs log tree commit diff
path: root/string/test-strncasecmp.c
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2010-11-10 03:05:37 -0500
committerUlrich Drepper <drepper@gmail.com>2010-11-10 03:05:37 -0500
commit8ca52c6e3b2dc44a46c32d6a8e6a7f608915998f (patch)
treefd2ff61641c3c584b23952682253c4065c82088c /string/test-strncasecmp.c
parent69da074d7adfab7b57004a0dea9403a928e310a5 (diff)
downloadglibc-8ca52c6e3b2dc44a46c32d6a8e6a7f608915998f.tar.gz
glibc-8ca52c6e3b2dc44a46c32d6a8e6a7f608915998f.tar.xz
glibc-8ca52c6e3b2dc44a46c32d6a8e6a7f608915998f.zip
Fix one exit path in x86-64 SSE4.2 str{,n}casecmp.
Diffstat (limited to 'string/test-strncasecmp.c')
-rw-r--r--string/test-strncasecmp.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/string/test-strncasecmp.c b/string/test-strncasecmp.c
index 80e4d6315e..daff6ede8f 100644
--- a/string/test-strncasecmp.c
+++ b/string/test-strncasecmp.c
@@ -70,9 +70,9 @@ stupid_strncasecmp (const char *s1, const char *s2, size_t max)
   return ret;
 }
 
-static void
-do_one_test (impl_t *impl, const char *s1, const char *s2, size_t n,
-	     int exp_result)
+static int
+check_result (impl_t *impl, const char *s1, const char *s2, size_t n,
+	      int exp_result)
 {
   int result = CALL (impl, s1, s2, n);
   if ((exp_result == 0 && result != 0)
@@ -82,9 +82,19 @@ do_one_test (impl_t *impl, const char *s1, const char *s2, size_t n,
       error (0, 0, "Wrong result in function %s %d %d", impl->name,
 	     result, exp_result);
       ret = 1;
-      return;
+      return -1;
     }
 
+  return 0;
+}
+
+static void
+do_one_test (impl_t *impl, const char *s1, const char *s2, size_t n,
+	     int exp_result)
+{
+  if (check_result (impl, s1, s2, n, exp_result) < 0)
+    return;
+
   if (HP_TIMING_AVAIL)
     {
       hp_timing_t start __attribute ((unused));
@@ -242,6 +252,25 @@ do_random_tests (void)
     }
 }
 
+
+static void
+check1 (void)
+{
+  static char cp [4096+16] __attribute__ ((aligned(4096)));
+  static char gotrel[4096] __attribute__ ((aligned(4096)));
+  char *s1 = cp + 0xffa;
+  char *s2 = gotrel + 0xcbe;
+  int exp_result;
+  size_t n = 6;
+
+  strcpy (s1, "gottpoff");
+  strcpy (s2, "GOTPLT");
+
+  exp_result = simple_strncasecmp (s1, s2, n);
+  FOR_EACH_IMPL (impl, 0)
+    check_result (impl, s1, s2, n, exp_result);
+}
+
 int
 test_main (void)
 {
@@ -249,6 +278,8 @@ test_main (void)
 
   test_init ();
 
+  check1 ();
+
   printf ("%23s", "");
   FOR_EACH_IMPL (impl, 0)
     printf ("\t%s", impl->name);