[COMMITTED] gnulib: Fix tst-gcc.c build with clang-23

Adhemerval Zanella adhemerval.zanella@linaro.org
Wed Aug 12 18:21:50 GMT 2026


clang-23 changed its uninitialized-use analysis to consider the operand
used.
---
 gnulib/tst-gcc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gnulib/tst-gcc.c b/gnulib/tst-gcc.c
index aad8a4f12ce..c1378972d88 100644
--- a/gnulib/tst-gcc.c
+++ b/gnulib/tst-gcc.c
@@ -17,6 +17,7 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <stdio.h>
+#include <libc-diag.h>
 
 #define __no_type_class		-1
 #define __void_type_class	 0
@@ -61,12 +62,17 @@ do_test (void)
   struct { int a; } __record_type;
   union { int a; int b; } __union_type;
 
+  /* clang warns that the variables are uninitializedd, but the builtin
+     only inspects the type of its operand and never evaluates it.  */
+  DIAG_PUSH_NEEDS_COMMENT_CLANG;
+  DIAG_IGNORE_NEEDS_COMMENT_CLANG (23, "-Wuninitialized");
   result |= TEST (integer);
   result |= TEST (pointer);
   result |= TEST (real);
   result |= TEST (complex);
   result |= TEST (record);
   result |= TEST (union);
+  DIAG_POP_NEEDS_COMMENT_CLANG;
 
   return result;
 }
-- 
2.53.0



More information about the Libc-alpha mailing list