[libc-commits] [libc] Add explicit conversion to fix arm64 builds. (PR #82429)

via libc-commits libc-commits at lists.llvm.org
Tue Feb 20 14:18:27 PST 2024


https://github.com/MosheBerman created https://github.com/llvm/llvm-project/pull/82429

Fixes issue preventing builds on ARM-based Macs.

https://github.com/llvm/llvm-project/issues/82205.



>From 3ef0d4e2e8b7805ca3d83856d93787bdf8c4a81e Mon Sep 17 00:00:00 2001
From: Moshe Berman <mosheberman at users.noreply.github.com>
Date: Tue, 20 Feb 2024 17:16:17 -0500
Subject: [PATCH] Add explicit conversion to fix arm64 builds.

---
 libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
index ea1fd68a5fcdfc..fd915373020ec9 100644
--- a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
+++ b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
@@ -161,8 +161,8 @@ LIBC_INLINE int set_except(int excepts) {
 LIBC_INLINE int raise_except(int excepts) {
   float zero = 0.0f;
   float one = 1.0f;
-  float large_value = FPBits<float>::max_normal();
-  float small_value = FPBits<float>::min_normal();
+  float large_value = FPBits<float>::max_normal().get_val();
+  float small_value = FPBits<float>::min_normal().get_val();
   auto divfunc = [](float a, float b) {
     __asm__ __volatile__("ldr  s0, %0\n\t"
                          "ldr  s1, %1\n\t"
@@ -277,8 +277,8 @@ LIBC_INLINE int set_env(const fenv_t *envp) {
     return 0;
   }
   const FEnv::FPState *state = reinterpret_cast<const FEnv::FPState *>(envp);
-  FEnv::set_control_word(state->ControlWord);
-  FEnv::set_status_word(state->StatusWord);
+  FEnv::set_control_word(static_cast<uint32_t>(state->ControlWord));
+  FEnv::set_status_word(static_cast<uint32_t>(state->StatusWord));
   return 0;
 }
 



More information about the libc-commits mailing list