This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix -D_FORTIFY_SOURCE memmove and bcopy

Hi! shows that with recent GCCs memmove
(or bcopy) might be "optimized" into memcpy with -D_FORTIFY_SOURCE, even
when the arguments overlap, because of the wrong restrict qualifiers.

Fixed thusly.

2010-12-09  Jakub Jelinek  <>

	* string/bits/string3.h (memmove, bcopy): Remove __restrict.

--- libc/string/bits/string3.h
+++ libc/string/bits/string3.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005, 2007, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    The GNU C Library is free software; you can redistribute it and/or
@@ -53,8 +53,7 @@ __NTH (memcpy (void *__restrict __dest, __const void *__restrict __src,
 __extern_always_inline void *
-__NTH (memmove (void *__restrict __dest, __const void *__restrict __src,
-		size_t __len))
+__NTH (memmove (void *__dest, __const void *__src, size_t __len))
   return __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest));
@@ -88,8 +87,7 @@ __NTH (memset (void *__dest, int __ch, size_t __len))
 #ifdef __USE_BSD
 __extern_always_inline void
-__NTH (bcopy (__const void *__restrict __src, void *__restrict __dest,
-	      size_t __len))
+__NTH (bcopy (__const void *__src, void *__dest, size_t __len))
   (void) __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest));


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]