https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87422
Bug ID: 87422 Summary: duplicate warning for strcpy of an unterminated character array Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- GCC issues two instances of the same warning for the following simple test case: $ cat c.c && gcc -O2 -S -Wall -Wextra -Wpedantic -fdump-tree-optimized=/dev/stdout c.c const char a[3] = { '1', '2', '3' }; int f (void) { return __builtin_strlen (a); // duplicate warning } c.c: In function ‘f’: c.c:5:29: warning: ‘strlen’ argument missing terminating nul [-Wstringop-overflow=] 5 | return __builtin_strlen (a); // duplicate warning | ^ c.c:1:12: note: referenced argument declared here 1 | const char a[3] = { '1', '2', '3' }; | ^ c.c:5:29: warning: ‘strlen’ argument missing terminating nul [-Wstringop-overflow=] 5 | return __builtin_strlen (a); // duplicate warning | ^ c.c:1:12: note: referenced argument declared here 1 | const char a[3] = { '1', '2', '3' }; | ^