<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/57090>57090</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [libc++] [test] max_size.pass.cpp fails for PowerPC targets
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc++
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            amy-kwan
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          amy-kwan
      </td>
    </tr>
</table>

<pre>
    This test case introduced in https://reviews.llvm.org/rG29c8c070a1770fc510ccad3be753f6f50336f8cc fails an assert on the PowerPC targets where `str.max_size()` does not equal what is expected.
```bash
Command Output (stdout):
--
$ ":" "COMPILED WITH"
$ "/data/amyk/compiler/community/build/./bin/clang++" "/data/amyk/compiler/community/llvm-project/libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp" "--target=powerpc64le-unknown-linux-gnu" "-nostdinc++" "-I" "/data/amyk/compiler/community/build/include/c++/v1" "-I" "/data/amyk/compiler/community/build/include/powerpc64le-unknown-linux-gnu/c++/v1" "-I" "/data/amyk/compiler/community/llvm-project/libcxx/test/support" "-std=c++2b" "-Werror" "-Wall" "-Wextra" "-Wshadow" "-Wundef" "-Wno-unused-command-line-argument" "-Wno-attributes" "-Wno-pessimizing-move" "-Wno-c++11-extensions" "-Wno-noexcept-type" "-Wno-atomic-alignment" "-Wno-user-defined-literals" "-Wno-tautological-compare" "-Wsign-compare" "-Wunused-variable" "-Wunused-parameter" "-Wunreachable-code" "-Wno-unused-local-typedef" "-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER" "-D_LIBCPP_ENABLE_EXPERIMENTAL" "-D_LIBCPP_DISABLE_AVAILABILITY" "-fcoroutines-ts" "-Werror=thread-safety" "-Wuser-defined-warnings" "-lc++experimental" "-nostdlib++" "-L" "/data/amyk/compiler/community/build/./lib/powerpc64le-unknown-linux-gnu" "-Wl,-rpath,/data/amyk/compiler/community/build/./lib/powerpc64le-unknown-linux-gnu" "-lc++" "-pthread" "-o" "/data/amyk/compiler/community/build/runtimes/runtimes-bins/test/libcxx/strings/basic.string/string.capacity/Output/max_size.pass.cpp.dir/t.tmp.exe"
$ ":" "EXECUTED AS"
$ "/usr/bin/python3.6" "/data/amyk/compiler/community/llvm-project/libcxx/test/../utils/run.py" "--execdir" "/data/amyk/compiler/community/build/runtimes/runtimes-bins/test/libcxx/strings/basic.string/string.capacity/Output/max_size.pass.cpp.dir" "--" "/data/amyk/compiler/community/build/runtimes/runtimes-bins/test/libcxx/strings/basic.string/string.capacity/Output/max_size.pass.cpp.dir/t.tmp.exe"
# command stderr:
t.tmp.exe: /data/amyk/compiler/community/llvm-project/libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp:45: void half_size(): Assertion `str.max_size() == std::numeric_limits<size_t>::max() / 2 - alignment' failed.

error: command failed with exit status: 250
```
This occurs because the behaviour of `max_size()` will differ depending on if it is on little endian or big endian, so we should be calling `half_size()` or `full_size()` depending on endianness.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzVV91v2zgM_2uSF8GGY-ejeciDm6RbgHYr1t5tewpkiY51kyWfJCfp_vqjbCdNmgLFdjvgBhi2PmiSP5IiqUzzp9ljISxxYB1h1AIRyhnNawYch6RwrrK9JO3FN_gY2ArY2VDKbRlqs_FL7-Ipu2LRJKKDySTK2WgQMUZ5ksFklOTjfBQlyTi_YozkVEhLqCLUWjCOaEVcAeRe78Dcz4mjZgPOkl0BBkhvHFlnwpLu11Z8h1581YunuEi4BkuUdgT-rqlEauoIAoB9BcwBD3vRohelSNk-GbVFuzTXZUkVJx9rV9WOIEfruK6d54sAG5og6H6Ph0gQN8BjP5p_vLtf3S4X5PPq8b3fOSOLbzh1FD-0fPqGH6bLSkgw7bCslXBPOM5qITl-Qz8Wyu9KqtCK180T_wgv74KgMvovRO2nImP7PQ68I0_naEShNtZLpFawsJ0fN0JGK8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