This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/88273] warning: 'memcpy' offset [-527, -529] is out of the bounds [0, 16] of object 'vrsave' with type 'union <anonymous>' [-Warray-bounds]
- From: "asolokha at gmx dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 30 Nov 2018 07:22:06 +0000
- Subject: [Bug middle-end/88273] warning: 'memcpy' offset [-527, -529] is out of the bounds [0, 16] of object 'vrsave' with type 'union <anonymous>' [-Warray-bounds]
- Auto-submitted: auto-generated
- References: <bug-88273-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88273
Arseny Solokha <asolokha at gmx dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |asolokha at gmx dot com
--- Comment #4 from Arseny Solokha <asolokha at gmx dot com> ---
(In reply to Martin Sebor from comment #3)
> Based on the text of the warning this looks similar to pr86827 except that I
> don't see it with the powerpc64-linux or x86_64-linux compilers and I don't
> have a powerpc cross-compiler handy at the moment.
It's there on 32-bit powerpc.
% powerpc-e300c3-linux-gnu-gcc-9.0.0-alpha20181125 -Warray-bounds -mcpu=powerpc
-fno-delete-null-pointer-checks -O2 -c pr88273.c
pr88273.c:3:1: warning: no semicolon at end of struct or union
3 | } b, c;
| ^
pr88273.c:4:1: warning: data definition has no type or storage class
4 | d, e;
| ^
pr88273.c:4:1: warning: type defaults to 'int' in declaration of 'd'
[-Wimplicit-int]
pr88273.c:4:4: warning: type defaults to 'int' in declaration of 'e'
[-Wimplicit-int]
4 | d, e;
| ^
pr88273.c:5:8: warning: return type defaults to 'int' [-Wimplicit-int]
5 | inline f(void *g, int h, int p3) {
| ^
pr88273.c: In function 'f':
pr88273.c:9:3: warning: implicit declaration of function 'memcpy'
[-Wimplicit-function-declaration]
9 | memcpy(e, g, copy);
| ^~~~~~
pr88273.c:9:3: warning: incompatible implicit declaration of built-in function
'memcpy'
pr88273.c:1:1: note: include '<string.h>' or provide a declaration of 'memcpy'
+++ |+#include <string.h>
1 | typedef struct {
pr88273.c:9:10: warning: passing argument 1 of 'memcpy' makes pointer from
integer without a cast [-Wint-conversion]
9 | memcpy(e, g, copy);
| ^
| |
| int
pr88273.c:9:10: note: expected 'void *' but argument is of type 'int'
pr88273.c: At top level:
pr88273.c:12:1: warning: return type defaults to 'int' [-Wimplicit-int]
12 | j() {
| ^
pr88273.c: In function 'j':
pr88273.c:16:3: warning: no semicolon at end of struct or union
16 | } vrsave;
| ^
In function 'f',
inlined from 'j' at pr88273.c:17:3:
pr88273.c:9:3: warning: 'memcpy' offset [-527, -529] is out of the bounds [0,
16] of object 'vrsave' with type 'union <anonymous>' [-Warray-bounds]
9 | memcpy(e, g, copy);
| ^~~~~~~~~~~~~~~~~~
pr88273.c: In function 'j':
pr88273.c:16:5: note: 'vrsave' declared here
16 | } vrsave;
| ^~~~~~