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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: OverMighty (overmighty)

<details>
<summary>Changes</summary>



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


2 Files Affected:

- (modified) libc/src/__support/str_to_integer.h (+2-1) 
- (modified) libc/src/math/generic/exp2m1f16.cpp (+1-1) 


``````````diff
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);
       }
     }
 

``````````

</details>


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


More information about the libc-commits mailing list