[libcxx-commits] [PATCH] D101206: [libc++] Remove UB in std::list

Eric Fiselier via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 29 08:37:01 PDT 2021


EricWF added a comment.

Has this been tested with various sanitizers on? Does it give warnings about weird object lifetimes?



================
Comment at: libcxx/include/list:274
+#ifndef _LIBCPP_CXX03_LANG
+    union { _Tp __value_; };
+#else
----------------
I'm a bit worried that there are combinations of types and compiler flags that will align a subobject differently when it's in a union than when it's not.
I need to investigate further.


================
Comment at: libcxx/include/list:1125
       __node_pointer __p = __node_alloc_traits::allocate(__na, 1);
+#ifndef _LIBCPP_CXX03_LANG
+      ::new ((void*)_VSTD::addressof(*__p)) __node();
----------------
Maybe we can sink these repeated lines of code into a function?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101206



More information about the libcxx-commits mailing list