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);
         ^

Reply via email to