[Bug middle-end/97374] New: missing essential detail in array parameter overflow warning
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Oct 11 23:24:21 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97374
Bug ID: 97374
Summary: missing essential detail in array parameter overflow
warning
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
The warning below doesn't provide enough information to understand what the
problem is. The first note should say something like
note: referencing argument 1 of type ‘int[4]’
$ cat q.c && gcc -O2 -S -Wall q.c
typedef int A[3];
typedef int B[4];
void f (B);
struct S { A x; B y; };
void g (struct S *p)
{
f (p->x);
}
q.c: In function ‘g’:
q.c:10:3: warning: ‘f’ accessing 16 bytes in a region of size 12
[-Wstringop-overflow=]
10 | f (p->x);
| ^~~~~~~~
q.c:10:3: note: referencing argument 1 of type ‘int *’
q.c:4:6: note: in a call to function ‘f’
4 | void f (B);
| ^
More information about the Gcc-bugs
mailing list