public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/99474] New: missing warning on an out of bounds VLA access by a pointer
@ 2021-03-08 21:36 msebor at gcc dot gnu.org
2021-04-02 17:30 ` [Bug tree-optimization/99474] " msebor at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-03-08 21:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99474
Bug ID: 99474
Summary: missing warning on an out of bounds VLA access by a
pointer
Product: gcc
Version: 11.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: ---
The out of bounds access in both functions below should be diagnosed by
-Warray-bounds but only the first one is.
$ cat v.c && gcc -O2 -S -Wall v.c
void f (void*);
void g (void)
{
int a[5];
int *p = &a[0];
p[5] = 0; // -Warray-bounds (good)
f (a);
}
void h (int n)
{
if (n > 5)
n = 5;
int a[n];
int *p = &a[0];
p[5] = 0; // missing warning
f (a);
}
v.c: In function ‘g’:
v.c:7:4: warning: array subscript 5 is outside array bounds of ‘int[5]’
[-Warray-bounds]
7 | p[5] = 0; // -Warray-bounds (good)
| ~^~~
v.c:5:7: note: while referencing ‘a’
5 | int a[5];
| ^
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug tree-optimization/99474] missing warning on an out of bounds VLA access by a pointer
2021-03-08 21:36 [Bug tree-optimization/99474] New: missing warning on an out of bounds VLA access by a pointer msebor at gcc dot gnu.org
@ 2021-04-02 17:30 ` msebor at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-04-02 17:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99474
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2021-04-02
Known to fail| |10.2.0, 11.0, 7.3.0, 8.3.0,
| |9.2.0
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed. This never worked.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-02 17:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08 21:36 [Bug tree-optimization/99474] New: missing warning on an out of bounds VLA access by a pointer msebor at gcc dot gnu.org
2021-04-02 17:30 ` [Bug tree-optimization/99474] " msebor at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).