[libc-commits] [libc] [libc] Fix socketopt_test on 32-bit builds (PR #192423)

via libc-commits libc-commits at lists.llvm.org
Thu Apr 16 03:22:58 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Pavel Labath (labath)

<details>
<summary>Changes</summary>

This is a follow-up to #<!-- -->192237, fixing build breakage on riscv32.

---
Full diff: https://github.com/llvm/llvm-project/pull/192423.diff


1 Files Affected:

- (modified) libc/test/src/sys/socket/linux/socketopt_test.cpp (+2-2) 


``````````diff
diff --git a/libc/test/src/sys/socket/linux/socketopt_test.cpp b/libc/test/src/sys/socket/linux/socketopt_test.cpp
index 3d03487f05cf8..67feef4670b0a 100644
--- a/libc/test/src/sys/socket/linux/socketopt_test.cpp
+++ b/libc/test/src/sys/socket/linux/socketopt_test.cpp
@@ -41,14 +41,14 @@ TEST_F(LlvmLibcSocketOptTest, BasicSocketOpt) {
                                          &optval, &optlen),
               Succeeds(0));
   ASSERT_EQ(optval, 1);
-  ASSERT_EQ(optlen, sizeof(optval));
+  ASSERT_EQ(optlen, static_cast<socklen_t>(sizeof(optval)));
 
   // Test SO_TYPE (read-only)
   ASSERT_THAT(
       LIBC_NAMESPACE::getsockopt(sock, SOL_SOCKET, SO_TYPE, &optval, &optlen),
       Succeeds(0));
   ASSERT_EQ(optval, SOCK_STREAM);
-  ASSERT_EQ(optlen, sizeof(optval));
+  ASSERT_EQ(optlen, static_cast<socklen_t>(sizeof(optval)));
 
   optval = SOCK_DGRAM;
   ASSERT_THAT(

``````````

</details>


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


More information about the libc-commits mailing list