[libcxx-commits] [PATCH] D75156: Some fixes for open breaks on MacOS and UBSan

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 26 15:51:55 PST 2020


ldionne added a subscriber: EricWF.
ldionne added inline comments.


================
Comment at: libcxx/src/barrier.cpp:40
+        size_t __allocation_size = __size + alignof(__state_t);
+        __state_allocation = unique_ptr<char[]>(new char[__allocation_size]);
+        void* __allocation = __state_allocation.get();
----------------
Couldn't we use the aligned versions of `operator new` and `delete` here? I believe we could then get rid of the `__state_t* __state` pointer?

I was going to suggest some complicated solution that does explicit calls to `operator new[](size_t, align_val_t)`, however after thinking about it harder I think simply compiling as C++17 would solve the problem, since the array would then be aligned properly.

@EricWF WDYT about building with C++17 enabled?


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D75156





More information about the libcxx-commits mailing list