PR tree-optimization/83369 - Missing diagnostics during inlining
[official-gcc.git] / gcc / testsuite / gcc.dg / pr78138.c
blobcda2fb8a6d005787693d855428274c041b00000f
1 /* PR middle-end/78138 - missing warnings on buffer overflow with non-constant
2 source length
3 { dg-do compile }
4 { dg-options "-O2 -Wformat-overflow" } */
6 char d [5];
8 __extension__ typedef __SIZE_TYPE__ size_t;
10 void* memcpy (void*, const void*, size_t);
11 extern char* strcpy (char*, const char*);
13 void f (int i, int j)
15 strcpy (d, j ? "12345" : "123456"); /* { dg-warning ".strcpy. writing between 6 and 7 bytes into a region of size 5 " } */
18 void g (void *p)
20 extern unsigned n;
21 if (n < 17 || 32 < n) n = 7;
23 memcpy (d, p, n); /* { dg-warning ".memcpy. writing between 7 and 32 bytes into a region of size 5" } */