Skip to content

[libc] Fix compilation errors thrown by GCC #112351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

overmighty
Copy link
Member

No description provided.

@overmighty overmighty requested a review from lntue October 15, 2024 12:31
@llvmbot llvmbot added the libc label Oct 15, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 15, 2024

@llvm/pr-subscribers-libc

Author: OverMighty (overmighty)

Changes

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

@overmighty overmighty merged commit aabdd8f into llvm:main Oct 15, 2024
7 of 8 checks passed
DanielCChen pushed a commit to DanielCChen/llvm-project that referenced this pull request Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants