https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100510
Bug ID: 100510
Summary: bogus -Wvla-large-than with -Walloca
Product: gcc
Version: 12.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 VLA below is at most 32 bytes large but with both -Walloca and
-Wvla-larger-than= GCC issues a -Wvla-larger-than false positive, both with and
without optimization.
$ cat a.c && gcc -Walloca -S -Wvla-larger-than=1000 a.c
void f (void*);
void g (__SIZE_TYPE__ n)
{
if (n > 32)
return;
char a[n];
f (a);
}
a.c: In function āgā:
a.c:8:8: warning: unbounded use of variable-length array [-Wvla-larger-than=]
8 | char a[n];
| ^