diff options
author | Jordan Rose <jordan_rose@apple.com> | 2017-03-11 01:24:56 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2017-03-11 01:24:56 +0000 |
commit | ca9ca5440ee72ab7e68315367ef9a3ef83064ed7 (patch) | |
tree | 114c57e5954092e89a76d715bd9544dd14da7086 /llvm/unittests/Support/BinaryStreamTest.cpp | |
parent | 3f1e8e0102b482973db88cfe4be92b80bc02fba3 (diff) | |
download | bcm5719-llvm-ca9ca5440ee72ab7e68315367ef9a3ef83064ed7.tar.gz bcm5719-llvm-ca9ca5440ee72ab7e68315367ef9a3ef83064ed7.zip |
[unittest] Explicitly specify alignment when using BumpPtrAllocator.
r297310 began inserting red zones around allocations under ASan, which
perturbs the alignment of subsequent allocations. Deliberately specify
this in two places where it matters.
Fixes failures when these tests are run under ASan and UBSan together.
Reviewed by Duncan Exon Smith.
rdar://problem/30980047
llvm-svn: 297540
Diffstat (limited to 'llvm/unittests/Support/BinaryStreamTest.cpp')
-rw-r--r-- | llvm/unittests/Support/BinaryStreamTest.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/unittests/Support/BinaryStreamTest.cpp b/llvm/unittests/Support/BinaryStreamTest.cpp index dfac3038c71..1e646a6cf90 100644 --- a/llvm/unittests/Support/BinaryStreamTest.cpp +++ b/llvm/unittests/Support/BinaryStreamTest.cpp @@ -686,7 +686,8 @@ TEST_F(BinaryStreamTest, BinaryItemStream) { std::vector<Foo> Foos = {{1, 1.0}, {2, 2.0}, {3, 3.0}}; BumpPtrAllocator Allocator; for (const auto &F : Foos) { - uint8_t *Ptr = Allocator.Allocate<uint8_t>(sizeof(Foo)); + uint8_t *Ptr = static_cast<uint8_t *>(Allocator.Allocate(sizeof(Foo), + alignof(Foo))); MutableArrayRef<uint8_t> Buffer(Ptr, sizeof(Foo)); MutableBinaryByteStream Stream(Buffer, llvm::support::big); BinaryStreamWriter Writer(Stream); |