[llvm-branch-commits] [libcxx] release/18.x: [libcxx] Align `__recommend() + 1` by __endian_factor (#90292) (PR #95264)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jul 2 14:50:49 PDT 2024


tickerguy wrote:

Reverting the one commit (three lines) fixes it on the Pi3 and does not break it on any of the other architectures I have.  releng/14.1 does not have that commit in it, which is why I never saw it until I built on stable/14, which does.

```
root at NewFS:/usr/src.14-STABLE` # git diff 55c5dad2f305f74d1ff5ca85c453635511aab9b2~ 55c5dad2f305f74d1ff5ca85c453635511aab9b2
diff --git a/contrib/llvm-project/libcxx/include/string b/contrib/llvm-project/libcxx/include/string
index ba169c3dbfc9..56e2ef09947f 100644
--- a/contrib/llvm-project/libcxx/include/string
+++ b/contrib/llvm-project/libcxx/include/string
@@ -1943,10 +1943,10 @@ private:
     if (__s < __min_cap) {
       return static_cast<size_type>(__min_cap) - 1;
     }
-    size_type __guess =
-        __align_it < sizeof(value_type) < __alignment ? __alignment / sizeof(value_type) : 1 > (__s + 1) - 1;
+    const size_type __boundary = sizeof(value_type) < __alignment ? __alignment / sizeof(value_type) : __endian_factor;
+    size_type __guess          = __align_it<__boundary>(__s + 1) - 1;
     if (__guess == __min_cap)
-      ++__guess;
+      __guess += __endian_factor;
     return __guess;
   }

```
With that out it does not blow up but when it comes to _why_ I lack sufficient understanding of the impacted code to know

https://github.com/llvm/llvm-project/pull/95264


More information about the llvm-branch-commits mailing list