[flang] [llvm] [CI] Enable -Werror in pre-merge CI (PR #155627)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 28 06:08:57 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-semantics

@llvm/pr-subscribers-flang-parser

Author: Nikita Popov (nikic)

<details>
<summary>Changes</summary>

We have many buildbots that run with -Werror, but it's currently not enabled in pre-merge CI, so adding a warning causes a slew of post-commit failures.

Note that we only guarantee warning freedom when compiling with a recent version of clang, but not when using gcc or msvc. The monolithic-linux build uses recent clang, so it should be safe to enable the option there.

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


3 Files Affected:

- (modified) .ci/monolithic-linux.sh (+2-1) 
- (modified) flang/lib/Evaluate/fold-implementation.h (+1-1) 
- (modified) flang/lib/Parser/characters.cpp (+2-1) 


``````````diff
diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh
index 3ca4d05f4c891..5abb8d72df028 100755
--- a/.ci/monolithic-linux.sh
+++ b/.ci/monolithic-linux.sh
@@ -61,7 +61,8 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
       -D LLDB_ENABLE_PYTHON=ON \
       -D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON \
       -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-      -D CMAKE_EXE_LINKER_FLAGS="-no-pie"
+      -D CMAKE_EXE_LINKER_FLAGS="-no-pie" \
+      -D LLVM_ENABLE_WERROR=ON
 
 start-group "ninja"
 
diff --git a/flang/lib/Evaluate/fold-implementation.h b/flang/lib/Evaluate/fold-implementation.h
index d757ef6e62eb4..3fdf3a6f38848 100644
--- a/flang/lib/Evaluate/fold-implementation.h
+++ b/flang/lib/Evaluate/fold-implementation.h
@@ -1785,7 +1785,7 @@ common::IfNoLvalue<std::optional<TO>, FROM> ConvertString(FROM &&s) {
       if (static_cast<std::uint64_t>(*iter) > 127) {
         return std::nullopt;
       }
-      str.push_back(*iter);
+      str.push_back(static_cast<typename TO::value_type>(*iter));
     }
     return std::make_optional<TO>(std::move(str));
   }
diff --git a/flang/lib/Parser/characters.cpp b/flang/lib/Parser/characters.cpp
index f6ac777ea874c..1a00b16eefe9d 100644
--- a/flang/lib/Parser/characters.cpp
+++ b/flang/lib/Parser/characters.cpp
@@ -289,7 +289,8 @@ RESULT DecodeString(const std::string &s, bool backslashEscapes) {
         DecodeCharacter<ENCODING>(p, bytes, backslashEscapes)};
     if (decoded.bytes > 0) {
       if (static_cast<std::size_t>(decoded.bytes) <= bytes) {
-        result.append(1, decoded.codepoint);
+        result.append(
+            1, static_cast<typename RESULT::value_type>(decoded.codepoint));
         bytes -= decoded.bytes;
         p += decoded.bytes;
         continue;

``````````

</details>


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


More information about the llvm-commits mailing list