aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/Walloca-larger-than.c
blob: e7851eabb463e449456ffb124cafb596d84fd186 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* PR middle-end/100425 - missing -Walloca-larger-than with -O0
   { dg-do compile }
   { dg-options "-O0 -Wall -Walloca-larger-than=128" } */

typedef __SIZE_TYPE__ size_t;

#if __cplusplus
extern "C"
#endif

void* alloca (size_t);

void sink (void*);

void warn_alloca_too_large (void)
{
  sink (alloca (1));
  sink (alloca (128));
  sink (alloca (129));    // { dg-warning "\\\[-Walloca-larger-than" }
  sink (alloca (1024));   // { dg-warning "\\\[-Walloca-larger-than" }
}