1 /* Test whether buffer overflow warnings for __strncat_chk builtin
2 are emitted properly. */
3 /* { dg-do compile } */
4 /* { dg-options "-O2 -std=gnu99" } */
6 extern void abort (void);
8 #include "../gcc.c-torture/execute/builtins/chk.h"
19 strncat (p
, "abcdefg", 9);
21 strncat (p
, "abcdefghi", 9);
23 strncat (p
, "abcdefghij", 9);
25 strncat (p
, "abcdefghi", 10);
27 strncat (p
, "abcdefghij", 10); /* { dg-warning "will always overflow" } */
29 strncat (p
, "abcdefgh", 11);
31 strncat (p
, "abcdefghijkl", 11); /* { dg-warning "will always overflow" } */
35 strncat (p
, q
, 10); /* { dg-warning "might overflow" } */
37 strncat (p
, q
, 11); /* { dg-warning "might overflow" } */