summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr78768.c
blob: 72ac3f871294698bd3099f1d38c5ecc0cbff61c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* PR c/78768 - -Walloca-larger-than and -Wformat-overflow warnings disabled
   by -flto
  { dg-do link }
  { dg-require-effective-target lto }
  { dg-require-linker-plugin "" }
  { dg-options "-O2 -Walloca-larger-than=10 -Wformat -Wformat-overflow -flto" } */

int main (void)
{
  char *d = (char *)__builtin_alloca (12);  /* { dg-warning "argument to .alloca. is too large" } */

  __builtin_sprintf (d, "%32s", "x");   /* { dg-warning "directive writing 32 bytes into a region of size 12" "-Wformat-overflow" } */

  return 0;
}