This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug c/29465] warning for overlapping memcpy()


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=29465

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
The -Wrestrict warning (new in GCC 7) points out this bug.  Unfortunately, the
option is not in -Wall or -Wextra and must be explicitly enabled so few users
will benefit from it.

$ gcc -S -Wrestrict t.c
t.c: In function ‘main’:
t.c:6:13: warning: passing argument 1 to restrict-qualified parameter aliases
with argument 2 [-Wrestrict]
     memcpy (&i, &i, sizeof i);
             ^~  ~~

*** This bug has been marked as a duplicate of bug 35503 ***

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