[PATCH] D93781: ADT: Fix reference invalidation in SmallVector::resize

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 20:46:47 PST 2021


dexonsmith added a comment.

In D93781#2470743 <https://reviews.llvm.org/D93781#2470743>, @dblaikie wrote:

> Looks good (did you happen to try this with sanitizers without the fix applied & observe a sanitizer failure when running the updated test? Would be nice to know that's actually working as intended)

No, but just now I ran with the SmallVector.h part of this patch mostly reverted (didn't add back the assertion), and the test fails:

  /Users/dexonsmith/data/github/llvm-project/working/llvm/unittests/ADT/SmallVectorTest.cpp:1139: Failure
        Expected: N
        Which is: 3
  To be equal to: V.back()
        Which is: 8-byte object <01-00 00-00 00-00 00-00>
  /Users/dexonsmith/data/github/llvm-project/working/llvm/unittests/ADT/SmallVectorTest.cpp:1145: Failure
        Expected: 1
  To be equal to: V.back()
        Which is: 8-byte object <01-04 00-00 00-00 00-00>

The line numbers are different vs. the patch posted here because of a rebase, but this seems to confirm the test is working even without sanitizers.

About to commit (`check-llvm` just finished on the rebase); I can follow up with ASan post-commit if you'd like (let me know if you would).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93781/new/

https://reviews.llvm.org/D93781



More information about the llvm-commits mailing list