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

--- Comment #3 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #2)
> GCC 9 prints the two warnings below with -m64 as well as -m32.  GCC 8.2.0
> prints them too but only in LP64 mode.  With -m32, it only warns about g.
> 
> $ gcc -O2 -S -Wall -m32 a.c
> a.c: In function ‘g’:
> a.c:12:3: warning: ‘__builtin_memcpy’ forming offset 5 is out of the bounds
> [0, 4] of object ‘a’ with type ‘const char[4]’ [-Warray-bounds]
>    12 |   __builtin_memcpy (d, a + 4, n);   // missing warning
>       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> a.c:10:14: note: ‘a’ declared here
>    10 |   const char a[] = "123";
>       |              ^
> a.c: In function ‘f’:
> a.c:5:3: warning: ‘__builtin_memcpy’ forming offset [5, 2147483651] is out
> of the bounds [0, 4] of object ‘a’ with type ‘const char[4]’ [-Warray-bounds]
>     5 |   __builtin_memcpy (d, a + 4, n);   // warning (ok)
>       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> a.c:3:14: note: ‘a’ declared here
>     3 |   const char a[] = "123";
>       |              ^

So we're down to just 1 missing warning now then?

Reply via email to