https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117377
Bug ID: 117377 Summary: Confusing -Wstringop-overflow warning with incorrect declaration (pointer to array vs pointer to first element) Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: sjames at gcc dot gnu.org CC: eggert at cs dot ucla.edu, qing.zhao at oracle dot com Blocks: 88443 Target Milestone: --- This is only an issue with old gnulib, as is the case in GNU patch. ``` $ gcc -c utimens.i utimens.c: In function ‘fdutimens’: utimens.c:383:17: warning: ‘update_timespec’ accessing 16 bytes in a region of size 8 [-Wstringop-overflow=] 383 | if (ts && update_timespec (&st, &ts)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ utimens.c:383:17: note: referencing argument 2 of type ‘struct timespec *[2]’ utimens.c:134:1: note: in a call to function ‘update_timespec’ 134 | update_timespec (struct stat const *statbuf, struct timespec *ts[2]) | ^~~~~~~~~~~~~~~ utimens.c: In function ‘lutimens’: utimens.c:596:17: warning: ‘update_timespec’ accessing 16 bytes in a region of size 8 [-Wstringop-overflow=] 596 | if (ts && update_timespec (&st, &ts)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ utimens.c:596:17: note: referencing argument 2 of type ‘struct timespec *[2]’ utimens.c:134:1: note: in a call to function ‘update_timespec’ 134 | update_timespec (struct stat const *statbuf, struct timespec *ts[2]) | ^~~~~~~~~~~~~~~ ``` gnulib changed their code in https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=a3a946f670718d0dee5a7425ad5ac0a29fb46ea1 (see https://lists.gnu.org/r/bug-tar/2021-04/msg00010.html), but I think the warning doesn't do a great job of explaining the problem either. But I'm also not sure what exactly we could do better, except maybe ignoring this construct. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443 [Bug 88443] [meta-bug] bogus/missing -Wstringop-overflow warnings