[libc-commits] [libc] [libc][math] Fix a -Wshadow warning in add_sub.h (PR #196337)

Nico Weber via libc-commits libc-commits at lists.llvm.org
Thu May 7 07:53:29 PDT 2026


https://github.com/nico created https://github.com/llvm/llvm-project/pull/196337

y_bits on line 111 was shadowing y_bits on line 48.

No behavior change.

>From c2427cb2cb50acb4ac001dd7a67603f394f74543 Mon Sep 17 00:00:00 2001
From: Nico Weber <thakis at chromium.org>
Date: Thu, 7 May 2026 10:49:55 -0400
Subject: [PATCH] [libc][math] Fix a -Wshadow warning in add_sub.h

y_bits on line 111 was shadowing y_bits on line 48.

No behavior change.
---
 libc/src/__support/FPUtil/generic/add_sub.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libc/src/__support/FPUtil/generic/add_sub.h b/libc/src/__support/FPUtil/generic/add_sub.h
index 6db5bcbb75020..a7f22865a6a00 100644
--- a/libc/src/__support/FPUtil/generic/add_sub.h
+++ b/libc/src/__support/FPUtil/generic/add_sub.h
@@ -108,10 +108,10 @@ add_or_sub(InType x, InType y) {
 
       if constexpr (cpp::is_same_v<InType, bfloat16> &&
                     cpp::is_same_v<OutType, bfloat16>) {
-        OutFPBits y_bits(y);
+        OutFPBits out_y_bits(y);
         if constexpr (IsSub)
-          y_bits.set_sign(y_bits.sign().negate());
-        return y_bits.get_val();
+          out_y_bits.set_sign(out_y_bits.sign().negate());
+        return out_y_bits.get_val();
       } else {
 
 #ifdef LIBC_HAS_CONSTANT_EVALUATION



More information about the libc-commits mailing list