Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/gcc.dg/Walloca-3.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
/* { dg-do compile } */ /* { dg-require-effective-target alloca } */ /* { dg-options "-Walloca-larger-than=2000 -O2" } */ void f (void *); __SIZE_TYPE__ LIMIT; // Warn when there is an alloca bound, but it is an unknown bound. void g1 (__SIZE_TYPE__ n) { void *p; if (n < LIMIT) p = __builtin_alloca (n); // { dg-warning "'alloca' bound is unknown" } else p = __builtin_malloc (n); f (p); } // Similar to the above, but do not get confused by the upcast. unsigned short SHORT_LIMIT; void g2 (unsigned short n) { void *p; if (n < SHORT_LIMIT) p = __builtin_alloca (n); // { dg-warning "'alloca' bound is unknown" } else p = __builtin_malloc (n); f (p); }