[PATCH] D93532: [ADT] Add resize_for_overwrite method to SmallVector.
Nathan James via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 22 03:36:48 PST 2020
njames93 added a comment.
In D93532#2466993 <https://reviews.llvm.org/D93532#2466993>, @dexonsmith wrote:
> LGTM. I'm hopeful we can somehow keep the tests once we instrument SmallVector for the sanitizers (see my comment below); even if not, I suppose we can drop the tests at that time.
>
> When that happens, will there be a way to update this testcase, maybe to something like this?
>
> V.push_back(5);
> V.pop_back();
> V.resize_for_overwrite(V.size() + 1);
> if (!is_sanitizer_poisoning_pop_back())
> EXPECT_EQ(5, V.back());
>
> or:
>
> V.resize_for_overwrite(V.size() + 1);
> if (is_sanitizer_poisoning_pop_back())
> EXPECT_TRUE(is_sanitizer_poison(V.back()));
> else
> EXPECT_EQ(5, V.back());
We can detect MSAN using
#if LLVM_MEMORY_SANITIZER_BUILD
// We have msan, don't run tests.
#else
<The test code>
#endif
If these tests are causing issues under msan, then just don't run them.
As an added bonus if the tests are failing under msan, that would mean that msan will help catch bugs when people abuse this by not writing to the new storage before reading.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93532/new/
https://reviews.llvm.org/D93532
More information about the llvm-commits
mailing list