diff options
Diffstat (limited to 'gcc/testsuite/c-c++-common/analyzer')
-rw-r--r-- | gcc/testsuite/c-c++-common/analyzer/out-of-bounds-pr114472.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-pr114472.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-pr114472.c new file mode 100644 index 0000000..ef9e771 --- /dev/null +++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-pr114472.c @@ -0,0 +1,17 @@ +/* Verify we don't ICE on cases involving very large values for size. */ + +char s, d; + +void +foo(void) +{ + __builtin_strncpy(&d, &s + 3, -1); /* { dg-warning "Wstringop-overflow" } */ + __builtin_strncpy(&d + 3, &s, -1); /* { dg-warning "Wstringop-overflow" } */ +} + +void +bar(void) +{ + __builtin_strncpy(&d, &s - 3, -1); /* { dg-warning "Wstringop-overflow" } */ + __builtin_strncpy(&d - 3, &s, -1); /* { dg-warning "Wstringop-overflow" } */ +} |