| 1 |
/* { dg-additional-options "-Wno-stringop-overflow" } */ |
| 2 |
/* { dg-additional-options "-fpermissive" { target c++ } } */ |
| 3 |
|
| 4 |
#include "../../gcc.dg/analyzer/analyzer-decls.h" |
| 5 |
|
| 6 |
char *example_fn (char *p, __SIZE_TYPE__ n) |
| 7 |
__attribute__((null_terminated_string_arg (1))) |
| 8 |
__attribute__((access (read_write, 1, 2))); |
| 9 |
|
| 10 |
char * |
| 11 |
test_unterminated_str (void) |
| 12 |
{ |
| 13 |
char str[3] = "abc"; /* { dg-warning "initializer-string for '\[^\n\]*' is too long" "" { target c++ } } */ |
| 14 |
return example_fn (str, 4); /* { dg-warning "stack-based buffer over-read" } */ |
| 15 |
} |