[llvm] Turn off uninitialized warnings for GCC up to 14. (PR #147968)

Harald van Dijk via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 10 06:53:36 PDT 2025


https://github.com/hvdijk created https://github.com/llvm/llvm-project/pull/147968

Although the false positives that caused it to be disabled originally may have been fixed in GCC 12, GCC also suffers from a problem where -Wuninitialized may cause the build to hang on some platforms (GCC #120729). This has been fixed in GCC 15, so turn on -Wuninitialized for GCC 15+ instead of GCC 12+.

>From 22b8c24f2805dbeee1aeba0f629988cdbe7555b6 Mon Sep 17 00:00:00 2001
From: Harald van Dijk <harald.vandijk at codeplay.com>
Date: Thu, 10 Jul 2025 14:52:35 +0100
Subject: [PATCH] Turn off uninitialized warnings for GCC up to 14.

Although the false positives that caused it to be disabled originally
may have been fixed in GCC 12, GCC also suffers from a problem where
-Wuninitialized may cause the build to hang on some platforms
(GCC #120729). This has been fixed in GCC 15, so turn on -Wuninitialized
for GCC 15+ instead of GCC 12+.
---
 llvm/cmake/config-ix.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index 0fcd73e752311..a8e4e5a63244d 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -510,7 +510,7 @@ set(USE_NO_UNINITIALIZED 0)
 # false positives.
 if (CMAKE_COMPILER_IS_GNUCXX)
   # Disable all -Wuninitialized warning for old GCC versions.
-  if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.0)
+  if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0)
     set(USE_NO_UNINITIALIZED 1)
   else()
     set(USE_NO_MAYBE_UNINITIALIZED 1)



More information about the llvm-commits mailing list