[libc-commits] [libc] [libc] Fix build failure at with ASSUME_ROUND_NEAREST_ONLY (PR #207991)

Simon Tatham via libc-commits libc-commits at lists.llvm.org
Tue Jul 7 05:34:59 PDT 2026


https://github.com/statham-arm created https://github.com/llvm/llvm-project/pull/207991

Commit 03c62ca40d19ba0 moved some local variables of `convert_float_hex_exp` into a struct called `properties`, but didn't edit the #ifdef branch for `LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY`, so builds with that definition failed.

>From 2a1ee29e2860c093439c50a2317615e85330a268 Mon Sep 17 00:00:00 2001
From: Simon Tatham <simon.tatham at arm.com>
Date: Tue, 7 Jul 2026 13:31:07 +0100
Subject: [PATCH] [libc] Fix build failure at with ASSUME_ROUND_NEAREST_ONLY

Commit 03c62ca40d19ba0 moved some local variables of
`convert_float_hex_exp` into a struct called `properties`, but didn't
edit the #ifdef branch for `LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY`,
so builds with that definition failed.
---
 libc/src/stdio/printf_core/float_hex_converter.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/src/stdio/printf_core/float_hex_converter.h b/libc/src/stdio/printf_core/float_hex_converter.h
index efa01970c365f..e0cb3893ec9a3 100644
--- a/libc/src/stdio/printf_core/float_hex_converter.h
+++ b/libc/src/stdio/printf_core/float_hex_converter.h
@@ -115,9 +115,9 @@ LIBC_INLINE int convert_float_hex_exp(Writer<write_mode> *writer,
 #ifdef LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY
     // Round to nearest, if it's exactly halfway then round to even.
     if (truncated_bits > halfway_const)
-      ++mantissa;
+      ++properties.mantissa;
     else if (truncated_bits == halfway_const)
-      mantissa = mantissa + (mantissa & 1);
+      properties.mantissa = properties.mantissa + (properties.mantissa & 1);
 #else
     switch (fputil::quick_get_round()) {
     case FE_TONEAREST:



More information about the libc-commits mailing list