]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix overflow check in profile_count::operator* (const sreal &num).
authorJan Hubicka <hubicka@ucw.cz>
Sun, 6 Jul 2025 08:48:46 +0000 (10:48 +0200)
committerJan Hubicka <hubicka@ucw.cz>
Sun, 6 Jul 2025 08:49:14 +0000 (10:49 +0200)
gcc/ChangeLog:

* profile-count.cc (profile_count::operator*): fix overflow check.

gcc/profile-count.cc

index 190bbebb5a776acd26143f4dac4c260367cc0ed9..21477008b702654540647570b66161b31129226d 100644 (file)
@@ -557,7 +557,7 @@ profile_count::operator* (const sreal &num) const
   sreal scaled = num * m_val;
   gcc_checking_assert (scaled >= 0);
   profile_count ret;
-  if (m_val > max_count)
+  if (scaled > max_count)
     ret.m_val = max_count;
   else
     ret.m_val = scaled.to_nearest_int ();