diff options
Diffstat (limited to 'test/Analysis/bstring.c')
-rw-r--r-- | test/Analysis/bstring.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Analysis/bstring.c b/test/Analysis/bstring.c index d74be0ffce..de88e9ae6f 100644 --- a/test/Analysis/bstring.c +++ b/test/Analysis/bstring.c @@ -136,6 +136,18 @@ void memcpy13() { memcpy(a, 0, 0); // no-warning } +void memcpy_unknown_size (size_t n) { + char a[4], b[4] = {1}; + if (memcpy(a, b, n) != a) + (void)*(char*)0; // no-warning +} + +void memcpy_unknown_size_warn (size_t n) { + char a[4]; + if (memcpy(a, 0, n) != a) // expected-warning{{Null pointer argument in call to byte string function}} + (void)*(char*)0; // no-warning +} + //===----------------------------------------------------------------------=== // mempcpy() //===----------------------------------------------------------------------=== @@ -246,6 +258,12 @@ void mempcpy13() { mempcpy(a, 0, 0); // no-warning } +void mempcpy_unknown_size_warn (size_t n) { + char a[4]; + if (mempcpy(a, 0, n) != a) // expected-warning{{Null pointer argument in call to byte string function}} + (void)*(char*)0; // no-warning +} + //===----------------------------------------------------------------------=== // memmove() //===----------------------------------------------------------------------=== |