[PATCH] D50717: [NFC][SimplifyCFG] Remove pointer from SmallPtrSet before deletion
Jakub Kuderski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 14 10:18:30 PDT 2018
kuhar added a comment.
In https://reviews.llvm.org/D50717#1199288, @dmgreen wrote:
> I'm no expert, but I thought that SmallPtrSet->erase(BB) would treat BB as an opaque value that it removes from it's set, not accessing it's content in any way. You may be right about the eraseFromParent invalidating things though.
>
> It's certainly much better this new way :)
I found this (C++14 [basic.stc.dynamic.deallocation]/4):
> Indirection through an invalid pointer value and passing an invalid pointer value to a deallocation function have undefined behavior. Any other use of an invalid pointer value has implementation-defined behavior.
> [ Footnote: Some implementations might define that copying an invalid pointer value causes a system-generated runtime fault. — end footnote ]
Seems like erasing from a set can cause both a copy (possibly a segfault) and produce unexpected values when used in comparison with other pointers.
Repository:
rL LLVM
https://reviews.llvm.org/D50717
More information about the llvm-commits
mailing list