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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |11.0

--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
Resolved by  r11-5523 for GCC 11 which now issues the following warnings for
the test case in comment #0 (the duplicate note needs to be fixed):

$ gcc -O2 -S pr89428.c
pr89428.c: In function ‘f’:
pr89428.c:7:3: warning: ‘__builtin_memset’ writing 7 bytes into a region of
size 6 overflows the destination [-Wstringop-overflow=]
    7 |   __builtin_memset (a + i, 0, 7);   // warning (good)
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pr89428.c:1:6: note: at offset [1, 2] into destination object ‘a’ of size 7
    1 | char a[7];
      |      ^
pr89428.c: In function ‘g’:
pr89428.c:14:3: warning: ‘__builtin_memset’ writing 99 bytes into a region of
size 7 overflows the destination [-Wstringop-overflow=]
   14 |   __builtin_memset (a + i, 0, 99);   // missing warning (bug)
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pr89428.c:1:6: note: destination object ‘a’ of size 7
    1 | char a[7];
      |      ^
pr89428.c:1:6: note: destination object ‘a’ of size 7

Reply via email to