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

--- Comment #6 from Arnd Bergmann <arnd at linaro dot org> ---
I got one file that produces a rather cryptic warning related to this:

In file included from /git/arm-soc/arch/x86/include/asm/page_32.h:35,
                 from /git/arm-soc/arch/x86/include/asm/page.h:14,
                 from /git/arm-soc/arch/x86/include/asm/thread_info.h:12,
                 from /git/arm-soc/include/linux/thread_info.h:38,
                 from /git/arm-soc/arch/x86/include/asm/preempt.h:7,
                 from /git/arm-soc/include/linux/preempt.h:81,
                 from /git/arm-soc/include/linux/spinlock.h:51,
                 from /git/arm-soc/include/linux/seqlock.h:36,
                 from /git/arm-soc/include/linux/time.h:6,
                 from /git/arm-soc/include/linux/stat.h:22,
                 from /git/arm-soc/include/linux/module.h:10,
                 from /git/arm-soc/drivers/isdn/isdnloop/isdnloop.c:12:
In function 'strcpy',
    inlined from 'isdnloop_parse_cmd' at
/git/arm-soc/drivers/isdn/isdnloop/isdnloop.c:900:3:
/git/arm-soc/include/linux/string.h:437:10: error: '__builtin_strcpy' accessing
0 or more bytes at offsets [36, 25] and 446 may overlap up to 0 bytes at offset
[9223372036854775807, -9223372036854775808] [-Werror=restrict]
   return __builtin_strcpy(p, q);

Not sure if gcc should try to avoid that warning or print something more
helpful in that case. The isdnloop code itself is cryptic enough that I'm not
surprised to see gcc get confused as well, and using strncpy() or strncpy()
instead of strcpy() would avoid the warning and improve the source code.

Possibly gcc should not warn about anything involving 'up to 0 bytes' though
;-)

Reply via email to