[Bug middle-end/94004] [8/9/10 Regression] missing -Walloca on calls to alloca due to -Wno-system-headers
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Mar 2 17:24:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94004
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Known to work| |7.3.0
Summary|missing -Walloca on calls |[8/9/10 Regression] missing
|to alloca due to |-Walloca on calls to alloca
|-Wno-system-headers |due to -Wno-system-headers
Known to fail| |10.0, 8.2.0, 9.1.0
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
GCC 7 issues a warning for each call to alloca, but GCC 8 diagnoses just the
__builtin_alloca call and not the one to alloca, making this a regression.
$ cat t.c && gcc-7 -S -O -Walloca-larger-than=8 t.c
#include <alloca.h>
void f (void*, ...);
void g (int n)
{
if (n < 88888)
n = 88888;
char *p = (char*) __builtin_alloca (n);
f (p, 0);
}
void h (int n)
{
if (n < 99999)
n = 99999;
char *p = (char*) alloca (n);
f (p, 1);
}
t.c: In function ‘g’:
t.c:9:9: warning: unbounded use of ‘alloca’ [-Walloca-larger-than=]
char *p = (char*) __builtin_alloca (n);
^
t.c: In function ‘h’:
t.c:17:9: warning: unbounded use of ‘alloca’ [-Walloca-larger-than=]
char *p = (char*) alloca (n);
^
More information about the Gcc-bugs
mailing list