]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gimple-ssa-sprintf: Fix typo in range check
authorSiddhesh Poyarekar <siddhesh@gotplt.org>
Thu, 25 Jul 2024 23:30:38 +0000 (19:30 -0400)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 28 Jul 2024 17:06:01 +0000 (19:06 +0200)
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 <siddhesh@gotplt.org>
gcc/gimple-ssa-sprintf.cc

index 025b0fbff6f99c8726aeb059ebfaa1393ce62247..0900710647c43c476bfaca6aff9850eff643cd0c 100644 (file)
@@ -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.  */