https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78918
--- Comment #7 from Dmitry G. Dyachenko <dimhen at gmail dot com> --- I'm a bit confused: -- warning about `static inline bar()' inlined into `foo()' -- and no warning about `baz()' What is the difference? May be no warnings will be more consistent? $ cat x.c #include <string.h> static inline void bar(void *d, void *s, unsigned N) { if(s != d) memcpy(d, s, N); } void baz(void *d, void *s, unsigned N) { if(s != d) memcpy(d, s, N); } void foo(void* src) { bar(src, src, 1); } $ gcc -O2 -S -Wall -Wextra -Wpedantic -Wrestrict x.c x.c: In function ‘foo’: x.c:5:2: warning: ‘memcpy’ source argument is the same as destination [-Wrestrict] memcpy(d, s, N); ^~~~~~~~~~~~~~~ $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/gcc_current/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none Target: x86_64-pc-linux-gnu Configured with: /home/dimhen/src/gcc_current/configure --prefix=/usr/local/gcc_current --enable-checking=yes,df,fold,rtl,extra --enable-languages=c,c++,lto --disable-multilib --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --with-tune=native Thread model: posix gcc version 8.0.0 20171217 (experimental) [trunk revision 255759] (GCC) $ gcc -O2 -S -Wall -Wextra -Wpedantic -Wrestrict -fdump-tree-optimized=/dev/stdout x.c x.c: In function ‘foo’: x.c:5:2: warning: ‘memcpy’ source argument is the same as destination [-Wrestrict] memcpy(d, s, N); ^~~~~~~~~~~~~~~ ;; Function baz (baz, funcdef_no=1, decl_uid=2076, cgraph_uid=1, symbol_order=1) baz (void * d, void * s, unsigned int N) { long unsigned int _1; <bb 2> [local count: 1073741825]: if (s_3(D) != d_4(D)) goto <bb 3>; [53.47%] else goto <bb 4>; [46.53%] <bb 3> [local count: 574129753]: _1 = (long unsigned int) N_6(D); memcpy (d_4(D), s_3(D), _1); [tail call] <bb 4> [local count: 1073741825]: return; } ;; Function foo (foo, funcdef_no=2, decl_uid=2079, cgraph_uid=2, symbol_order=2) foo (void * src) { <bb 2> [local count: 1073741825]: return; }