view gcc/testsuite/gcc.dg/Walloca-4.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 1830386684a0
line wrap: on
line source

/* { dg-do compile } */
/* { dg-require-effective-target alloca } */
/* { dg-options "-Walloca-larger-than=5000 -O2" } */

 char *
 _i18n_number_rewrite (char *w, char *rear_ptr)
{

  char *src;
 _Bool 
      use_alloca = (((rear_ptr - w) * sizeof (char)) < 4096U);
 if (use_alloca)
    src = (char *) __builtin_alloca ((rear_ptr - w) * sizeof (char));
  else
    src = (char *) __builtin_malloc ((rear_ptr - w) * sizeof (char));
  return src;
}