powerpc: Fix ifuncmain6pie failure with GCC 4.9
[platform/upstream/glibc.git] / string / stratcliff.c
index 5165be2..e161307 100644 (file)
@@ -1,6 +1,5 @@
 /* Test for string function add boundaries of usable memory.
-   Copyright (C) 1996,1997,1999-2003,2007,2009,2010
-   Free Software Foundation, Inc.
+   Copyright (C) 1996-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -15,9 +14,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #define _GNU_SOURCE 1
 
@@ -240,7 +238,7 @@ do_test (void)
            }
        }
 
-      /* This function only exists for single-byte characters.  */
+      /* These functions only exist for single-byte characters.  */
 #ifndef WCSTEST
       /* rawmemchr test */
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
@@ -261,6 +259,37 @@ do_test (void)
              adr[middle] = L('T');
            }
        }
+
+      /* memrchr test */
+      for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
+       {
+         for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
+           {
+             adr[middle] = L('V');
+
+             CHAR *cp = memrchr (&adr[outer], L('V'), nchars - outer);
+
+             if (cp - &adr[outer] != middle - outer)
+               {
+                 printf ("%s flunked for outer = %d, middle = %d\n",
+                         STRINGIFY (memrchr), outer, middle);
+                 result = 1;
+               }
+
+             adr[middle] = L('T');
+           }
+       }
+      for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
+       {
+         CHAR *cp = memrchr (&adr[outer], L('V'), nchars - outer);
+
+         if (cp != NULL)
+           {
+             printf ("%s flunked for outer = %d\n",
+                     STRINGIFY (memrchr), outer);
+             result = 1;
+           }
+       }
 #endif
 
       /* strcpy/wcscpy test */