[libc-commits] [libc] aabdd8f - [libc] Fix compilation errors thrown by GCC (#112351)

via libc-commits libc-commits at lists.llvm.org
Tue Oct 15 05:44:38 PDT 2024


Author: OverMighty
Date: 2024-10-15T14:44:35+02:00
New Revision: aabdd8f81826d2f33b67cad0dfc9768fdb3d100c

URL: https://github.com/llvm/llvm-project/commit/aabdd8f81826d2f33b67cad0dfc9768fdb3d100c
DIFF: https://github.com/llvm/llvm-project/commit/aabdd8f81826d2f33b67cad0dfc9768fdb3d100c.diff

LOG: [libc] Fix compilation errors thrown by GCC (#112351)

Added: 
    

Modified: 
    libc/src/__support/str_to_integer.h
    libc/src/math/generic/exp2m1f16.cpp

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/str_to_integer.h b/libc/src/__support/str_to_integer.h
index ea17178c6afb6a..c8d02434c89ce2 100644
--- a/libc/src/__support/str_to_integer.h
+++ b/libc/src/__support/str_to_integer.h
@@ -115,7 +115,8 @@ strtointeger(const char *__restrict src, int base,
                    : cpp::numeric_limits<T>::max();
   ResultType const abs_max =
       (is_positive ? cpp::numeric_limits<T>::max() : NEGATIVE_MAX);
-  ResultType const abs_max_div_by_base = abs_max / base;
+  ResultType const abs_max_div_by_base =
+      static_cast<ResultType>(abs_max / base);
 
   while (src_cur < src_len && isalnum(src[src_cur])) {
     int cur_digit = b36_char_to_int(src[src_cur]);

diff  --git a/libc/src/math/generic/exp2m1f16.cpp b/libc/src/math/generic/exp2m1f16.cpp
index e6c57d730e3c2d..6a1cd2328a050e 100644
--- a/libc/src/math/generic/exp2m1f16.cpp
+++ b/libc/src/math/generic/exp2m1f16.cpp
@@ -126,7 +126,7 @@ LLVM_LIBC_FUNCTION(float16, exp2m1f16, (float16 x)) {
       case FE_DOWNWARD:
         return FPBits::one(Sign::NEG).get_val();
       default:
-        return -0x1.ffcp-1;
+        return fputil::cast<float16>(-0x1.ffcp-1);
       }
     }
 


        


More information about the libc-commits mailing list