[libcxx-commits] [PATCH] D134363: [libc++] Avoid relying on non-portable behaviour in std::align

Alexander Richardson via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 26 04:52:33 PDT 2022


arichardson updated this revision to Diff 462867.
arichardson added a comment.

rebase for CI


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134363

Files:
  libcxx/src/memory.cpp


Index: libcxx/src/memory.cpp
===================================================================
--- libcxx/src/memory.cpp
+++ libcxx/src/memory.cpp
@@ -194,7 +194,7 @@
     if (size <= space)
     {
         char* p1 = static_cast<char*>(ptr);
-        char* p2 = reinterpret_cast<char*>(reinterpret_cast<size_t>(p1 + (alignment - 1)) & -alignment);
+        char* p2 = reinterpret_cast<char*>(reinterpret_cast<uintptr_t>(p1 + (alignment - 1)) & -alignment);
         size_t d = static_cast<size_t>(p2 - p1);
         if (d <= space - size)
         {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134363.462867.patch
Type: text/x-patch
Size: 553 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220926/5cedae6d/attachment.bin>


More information about the libcxx-commits mailing list