https://gcc.gnu.org/g:e21f9f6054e16bc2d7cd3bc0226f53a758d92fe0

commit e21f9f6054e16bc2d7cd3bc0226f53a758d92fe0
Author: Siddhesh Poyarekar <siddh...@gotplt.org>
Date:   Thu Jul 25 19:30:38 2024 -0400

    gimple-ssa-sprintf: Fix typo in range check
    
    The code to scale ranges for wide chars in format_string incorrectly
    checks range.likely to scale range.unlikely, which is a copy-paste typo
    from the immediate previous condition.
    
    gcc/ChangeLog:
    
            * gimple-ssa-sprintf.cc (format_string): Fix type in range check
            for UNLIKELY for wide chars.
    
    Signed-off-by: Siddhesh Poyarekar <siddh...@gotplt.org>

Diff:
---
 gcc/gimple-ssa-sprintf.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/gimple-ssa-sprintf.cc b/gcc/gimple-ssa-sprintf.cc
index 025b0fbff6f9..0900710647c4 100644
--- a/gcc/gimple-ssa-sprintf.cc
+++ b/gcc/gimple-ssa-sprintf.cc
@@ -2623,7 +2623,7 @@ format_string (const directive &dir, tree arg, 
pointer_query &ptr_qry)
          if (slen.range.likely < target_int_max ())
            slen.range.likely *= 2;
 
-         if (slen.range.likely < target_int_max ())
+         if (slen.range.unlikely < target_int_max ())
            slen.range.unlikely *= target_mb_len_max ();
 
          /* A non-empty wide character conversion may fail.  */

Reply via email to