[libc-commits] [libc] [llvm] [libc][workflows] fix pre-commit fullbuild and re-enable gcc (PR #119441)

Schrodinger ZHU Yifan via libc-commits libc-commits at lists.llvm.org
Tue Dec 10 11:53:48 PST 2024


https://github.com/SchrodingerZhu updated https://github.com/llvm/llvm-project/pull/119441

>From c87af65d30c2aed5b1e41c4b10a1e2cc5843f0c2 Mon Sep 17 00:00:00 2001
From: Schrodinger ZHU Yifan <i at zhuyi.fan>
Date: Tue, 10 Dec 2024 11:34:25 -0800
Subject: [PATCH 1/3] [libc][workflows] try fix build

---
 .github/workflows/libc-fullbuild-tests.yml | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/libc-fullbuild-tests.yml b/.github/workflows/libc-fullbuild-tests.yml
index b07e94244c2e8c..357e9064e90100 100644
--- a/.github/workflows/libc-fullbuild-tests.yml
+++ b/.github/workflows/libc-fullbuild-tests.yml
@@ -18,9 +18,8 @@ jobs:
         include:
           - c_compiler: clang
             cpp_compiler: clang++
-          # TODO: add back gcc build when it is fixed
-          # - c_compiler: gcc
-          #   cpp_compiler: g++
+          - c_compiler: gcc
+            cpp_compiler: g++
     steps:
     - uses: actions/checkout at v4
     
@@ -44,7 +43,7 @@ jobs:
     - name: Prepare dependencies (Ubuntu)
       run: |
         sudo apt-get update
-        sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build linux-headers-generic linux-libc-dev
+        sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build linux-libc-dev
         sudo ln -sf /usr/include/$(uname -p)-linux-gnu/asm /usr/include/asm
 
     - name: Set reusable strings

>From d8d6eaf086ca07825ce256f5da69614dbd5a0911 Mon Sep 17 00:00:00 2001
From: Schrodinger ZHU Yifan <i at zhuyi.fan>
Date: Tue, 10 Dec 2024 11:39:12 -0800
Subject: [PATCH 2/3] more fixes

---
 libc/src/__support/FPUtil/except_value_utils.h | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/libc/src/__support/FPUtil/except_value_utils.h b/libc/src/__support/FPUtil/except_value_utils.h
index f8e4e92d3e1fb3..6fc9ea1acc4a46 100644
--- a/libc/src/__support/FPUtil/except_value_utils.h
+++ b/libc/src/__support/FPUtil/except_value_utils.h
@@ -81,15 +81,21 @@ template <typename T, size_t N> struct ExceptValues {
         StorageType out_bits = values[i].rnd_towardzero_result;
         switch (fputil::quick_get_round()) {
         case FE_UPWARD:
-          out_bits += sign ? values[i].rnd_downward_offset
-                           : values[i].rnd_upward_offset;
+          out_bits += sign ? static_cast<decltype(out_bits)>(
+                                 values[i].rnd_downward_offset)
+                           : static_cast<decltype(out_bits)>(
+                                 values[i].rnd_upward_offset);
           break;
         case FE_DOWNWARD:
-          out_bits += sign ? values[i].rnd_upward_offset
-                           : values[i].rnd_downward_offset;
+          out_bits +=
+              sign
+                  ? static_cast<decltype(out_bits)>(values[i].rnd_upward_offset)
+                  : static_cast<decltype(out_bits)>(
+                        values[i].rnd_downward_offset);
           break;
         case FE_TONEAREST:
-          out_bits += values[i].rnd_tonearest_offset;
+          out_bits +=
+              static_cast<decltype(out_bits)>(values[i].rnd_tonearest_offset);
           break;
         }
         T result = FPBits<T>(out_bits).get_val();

>From 0dce8645d4b1fa2e4a6e2b058bca85c9c3bc1d10 Mon Sep 17 00:00:00 2001
From: Schrodinger ZHU Yifan <i at zhuyi.fan>
Date: Tue, 10 Dec 2024 11:53:37 -0800
Subject: [PATCH 3/3] lift casting to outer scope

---
 libc/src/__support/FPUtil/except_value_utils.h | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/libc/src/__support/FPUtil/except_value_utils.h b/libc/src/__support/FPUtil/except_value_utils.h
index 6fc9ea1acc4a46..0494c1fb104b56 100644
--- a/libc/src/__support/FPUtil/except_value_utils.h
+++ b/libc/src/__support/FPUtil/except_value_utils.h
@@ -81,17 +81,14 @@ template <typename T, size_t N> struct ExceptValues {
         StorageType out_bits = values[i].rnd_towardzero_result;
         switch (fputil::quick_get_round()) {
         case FE_UPWARD:
-          out_bits += sign ? static_cast<decltype(out_bits)>(
-                                 values[i].rnd_downward_offset)
-                           : static_cast<decltype(out_bits)>(
-                                 values[i].rnd_upward_offset);
+          out_bits += static_cast<decltype(out_bits)>(
+              sign ? values[i].rnd_downward_offset
+                   : values[i].rnd_upward_offset);
           break;
         case FE_DOWNWARD:
-          out_bits +=
-              sign
-                  ? static_cast<decltype(out_bits)>(values[i].rnd_upward_offset)
-                  : static_cast<decltype(out_bits)>(
-                        values[i].rnd_downward_offset);
+          out_bits += static_cast<decltype(out_bits)>(
+              sign ? values[i].rnd_upward_offset
+                   : values[i].rnd_downward_offset);
           break;
         case FE_TONEAREST:
           out_bits +=



More information about the libc-commits mailing list