diff options
author | Florian Hahn <florian.hahn@arm.com> | 2018-11-25 19:38:02 +0000 |
---|---|---|
committer | Florian Hahn <florian.hahn@arm.com> | 2018-11-25 19:38:02 +0000 |
commit | 4238cd5dd7d3e54ea372c6dc4fc06c2ccd10a63b (patch) | |
tree | 0971e8078f0baa797bed27a48e1015f50c8f09ac /llvm/unittests/IR/MetadataTest.cpp | |
parent | c6fa5bc7c7fa1770c3cbe5b909d0c5156876515a (diff) | |
download | bcm5719-llvm-4238cd5dd7d3e54ea372c6dc4fc06c2ccd10a63b.tar.gz bcm5719-llvm-4238cd5dd7d3e54ea372c6dc4fc06c2ccd10a63b.zip |
[MetadataTest] Fix off-by-one strncpy warning reported by gcc8. (NFC)
llvm-svn: 347528
Diffstat (limited to 'llvm/unittests/IR/MetadataTest.cpp')
-rw-r--r-- | llvm/unittests/IR/MetadataTest.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp index b2ffb80b15e..3f744cd5e6d 100644 --- a/llvm/unittests/IR/MetadataTest.cpp +++ b/llvm/unittests/IR/MetadataTest.cpp @@ -147,11 +147,9 @@ TEST_F(MDStringTest, CreateSame) { // Test that MDString prints out the string we fed it. TEST_F(MDStringTest, PrintingSimple) { - char *str = new char[13]; - strncpy(str, "testing 1 2 3", 13); - MDString *s = MDString::get(Context, StringRef(str, 13)); - strncpy(str, "aaaaaaaaaaaaa", 13); - delete[] str; + char str[14] = "testing 1 2 3"; + MDString *s = MDString::get(Context, StringRef(&str[0], 13)); + strncpy(str, "aaaaaaaaaaaaa", 14); std::string Str; raw_string_ostream oss(Str); |