Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/gcc.dg/Walloca-3.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
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); }