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

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


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

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

>From 41d1ef3d6afff91939248a7c3f44d59759d7a79e Mon Sep 17 00:00:00 2001
From: Pavel Labath <pavel at labath.sk>
Date: Thu, 16 Apr 2026 12:19:26 +0200
Subject: [PATCH] [libc] Fix socketopt_test on 32-bit builds

This is a follow-up to #192237, fixing build breakage on riscv32.
---
 libc/test/src/sys/socket/linux/socketopt_test.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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(



More information about the libc-commits mailing list