@@ -10,6 +10,7 @@ void free (void *);
char *strdup (const char *);
size_t strlen (const char *);
void *memcpy (void *__restrict, const void *__restrict, size_t);
+void *memmove (void *, const void *, size_t);
char *strcpy (char *__restrict, const char *__restrict);
char *strcat (char *__restrict, const char *__restrict);
char *strchr (const char *, int);
@@ -31,6 +32,12 @@ memcpy (void *__restrict dest, const void *__restrict src, size_t len)
return __builtin___memcpy_chk (dest, src, len, bos0 (dest));
}
+extern inline __attribute__((gnu_inline, always_inline, artificial)) void *
+memmove (void *dest, const void *src, size_t len)
+{
+ return __builtin___memmove_chk (dest, src, len, bos0 (dest));
+}
+
extern inline __attribute__((gnu_inline, always_inline, artificial)) char *
strcpy (char *__restrict dest, const char *__restrict src)
{
@@ -2,7 +2,7 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-strlen" } */
/* { dg-final { scan-tree-dump "memcpy.chkp" "strlen" } } */
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
char *test (char *str1, char *str2)
{
@@ -3,8 +3,8 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-strlen" } */
/* { dg-final { scan-tree-dump-not "strlen" "strlen" } } */
-#define _GNU_SOURCE
-#include "string.h"
+#define USE_GNU
+#include "../../gcc.dg/strlenopt.h"
char *test (char *str1, char *str2)
{
@@ -2,7 +2,7 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-strlen" } */
/* { dg-final { scan-tree-dump-times "strlen" 1 "strlen" } } */
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
size_t test (char *str1, char *str2)
{
@@ -3,8 +3,8 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-strlen" } */
/* { dg-final { scan-tree-dump-times "strlen" 1 "strlen" } } */
-#define _GNU_SOURCE
-#include "string.h"
+#define USE_GNU
+#include "../../gcc.dg/strlenopt.h"
char * test (char *str1, char *str2)
{
@@ -3,7 +3,7 @@
/* { dg-final { scan-tree-dump-times "strlen" 2 "strlen" } } */
/* { dg-final { scan-tree-dump "memcpy" "strlen" } } */
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
size_t test (char *str1, char *str2)
{
@@ -2,7 +2,7 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions" } */
/* { dg-final { scan-tree-dump "memcpy_nochk" "chkpopt" } } */
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
void test (int *buf1, int *buf2, size_t len)
{
@@ -2,7 +2,7 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */
/* { dg-final { scan-tree-dump-not "memset_nobnd" "chkpopt" } } */
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
void test (void *buf1, int c, size_t len)
{
@@ -2,7 +2,7 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */
/* { dg-final { scan-tree-dump-not "memmove_nobnd" "chkpopt" } } */
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
void test (void *buf1, void *buf2, size_t len)
{
@@ -3,8 +3,8 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */
/* { dg-final { scan-tree-dump-not "mempcpy_nobnd" "chkpopt" } } */
-#define _GNU_SOURCE
-#include "string.h"
+#define USE_GNU
+#include "../../gcc.dg/strlenopt.h"
void test (void *buf1, void *buf2, size_t len)
{
@@ -2,7 +2,7 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions -fchkp-use-fast-string-functions" } */
/* { dg-final { scan-tree-dump "memcpy_nobnd_nochk" "chkpopt" } } */
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
void test (int *buf1, int *buf2, size_t len)
{
@@ -2,7 +2,7 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions -fchkp-use-fast-string-functions" } */
/* { dg-final { scan-tree-dump "memset_nobnd_nochk" "chkpopt" } } */
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
void test (int *buf1, int c, size_t len)
{
@@ -2,7 +2,7 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions -fchkp-use-fast-string-functions" } */
/* { dg-final { scan-tree-dump "memmove_nobnd_nochk" "chkpopt" } } */
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
void test (int *buf1, int *buf2, size_t len)
{
@@ -3,8 +3,8 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions -fchkp-use-fast-string-functions" } */
/* { dg-final { scan-tree-dump "mempcpy_nobnd_nochk" "chkpopt" } } */
-#define _GNU_SOURCE
-#include "string.h"
+#define USE_GNU
+#include "../../gcc.dg/strlenopt.h"
void test (int *buf1, int *buf2, size_t len)
{
@@ -2,7 +2,7 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions" } */
/* { dg-final { scan-tree-dump "memset_nochk" "chkpopt" } } */
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
void test (int *buf1, int c, size_t len)
{
@@ -2,7 +2,7 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions" } */
/* { dg-final { scan-tree-dump "memmove_nochk" "chkpopt" } } */
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
void test (int *buf1, int *buf2, size_t len)
{
@@ -3,8 +3,8 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions" } */
/* { dg-final { scan-tree-dump "mempcpy_nochk" "chkpopt" } } */
-#define _GNU_SOURCE
-#include "string.h"
+#define USE_GNU
+#include "../../gcc.dg/strlenopt.h"
void test (int *buf1, int *buf2, size_t len)
{
@@ -2,7 +2,7 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */
/* { dg-final { scan-tree-dump "memcpy_nobnd" "chkpopt" } } */
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
void test (int *buf1, int *buf2, size_t len)
{
@@ -2,7 +2,7 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */
/* { dg-final { scan-tree-dump "memset_nobnd" "chkpopt" } } */
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
void test (int *buf1, int c, size_t len)
{
@@ -2,7 +2,7 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */
/* { dg-final { scan-tree-dump "memmove_nobnd" "chkpopt" } } */
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
void test (int *buf1, int *buf2, size_t len)
{
@@ -3,8 +3,8 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */
/* { dg-final { scan-tree-dump "mempcpy_nobnd" "chkpopt" } } */
-#define _GNU_SOURCE
-#include "string.h"
+#define USE_GNU
+#include "../../gcc.dg/strlenopt.h"
void test (int *buf1, int *buf2, size_t len)
{
@@ -2,7 +2,7 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */
/* { dg-final { scan-tree-dump-not "memcpy_nobnd" "chkpopt" } } */
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
void test (void *buf1, void *buf2, size_t len)
{