[PATCH] D12299: [libcxx] Fix for ALL undefined behavior in <list>.
Marshall Clow via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 30 11:44:03 PST 2015
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.
Minor changes; other than that, LGTM.
================
Comment at: include/__config:43
@@ -42,1 +42,3 @@
+// Fix undefined behavior in how std::list stores it's linked nodes.
+#define _LIBCPP_ABI_LIST_NODE_FIX
#endif
----------------
I would make this macro less generic than "fix". Maybe something like `_LIBCPP_ABI_LIST_REMOVE_UB_NODEPTR`
================
Comment at: include/list:690
@@ -662,3 +689,3 @@
__f = __f->__next_;
- __node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
- __node_alloc_traits::deallocate(__na, __n, 1);
+ __node_pointer __np = __n->__as_node();
+ __node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
----------------
Do you really need `__n` here?
How about:
__node_pointer __np = __f->__as_node();
__f = __f->__next_;
http://reviews.llvm.org/D12299
More information about the cfe-commits
mailing list