From 9bee1d7bfcbd58df6386c6f2cc21a9f69faef1f0 Mon Sep 17 00:00:00 2001 From: Mingchuan Wu Date: Mon, 10 Mar 2025 16:29:02 +0800 Subject: [PATCH] [tracer-static] Fix divide-by-zero error. (cherry picked from commit 4d458cdd203e365c43521e195c136b77b6fea024) --- ...acer-static-Fix-divide-by-zero-error.patch | 31 +++++++++++++++++++ gcc.spec | 12 +++++-- 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 0359-tracer-static-Fix-divide-by-zero-error.patch diff --git a/0359-tracer-static-Fix-divide-by-zero-error.patch b/0359-tracer-static-Fix-divide-by-zero-error.patch new file mode 100644 index 0000000..4242098 --- /dev/null +++ b/0359-tracer-static-Fix-divide-by-zero-error.patch @@ -0,0 +1,31 @@ +From 20ec64e203861ed4f2e52193d1a4b8f19af2be27 Mon Sep 17 00:00:00 2001 +From: Mingchuan Wu +Date: Mon, 10 Mar 2025 11:00:12 +0800 +Subject: [PATCH] [tracer-static] Fix divide-by-zero error. Fix divide-by-zero + error when using 'dump-tree-tracer'. + +--- + gcc/tracer.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gcc/tracer.cc b/gcc/tracer.cc +index 9b1578cd4..bc2da83ec 100644 +--- a/gcc/tracer.cc ++++ b/gcc/tracer.cc +@@ -394,11 +394,11 @@ tail_duplicate (void) + if (ignore_bb_p (bb)) + break; + } +- if (dump_file) ++ if (dump_file && (!flag_tracer_static || weighted_insns)) + fprintf (dump_file, " covered now %.1f\n\n", + traced_insns * 100.0 / weighted_insns); + } +- if (dump_file) ++ if (dump_file && (!flag_tracer_static || ninsns)) + fprintf (dump_file, "Duplicated %i insns (%i%%)\n", nduplicated, + nduplicated * 100 / ninsns); + +-- +2.48.1 + diff --git a/gcc.spec b/gcc.spec index b8733d9..4727ec1 100644 --- a/gcc.spec +++ b/gcc.spec @@ -2,7 +2,7 @@ %global gcc_major 12 # Note, gcc_release must be integer, if you want to add suffixes to # %%{release}, append them after %%{gcc_release} on Release: line. -%global gcc_release 75 +%global gcc_release 76 %global _unpackaged_files_terminate_build 0 %global _performance_build 1 @@ -464,6 +464,7 @@ Patch355: 0355-Fix-errors-in-ipa-struct-sfc-IBMY84-IBN2JO-IBN42Q.patch Patch356: 0356-Avoid-doing-sfc-with-struct_split-and-compressing-de.patch Patch357: 0357-struct-reorg-disable-malloc-support-when-struct_layo.patch Patch358: 0358-struct-reorg-fix-residual-ssa_name-issue.patch +Patch359: 0359-tracer-static-Fix-divide-by-zero-error.patch # Part 1001-1999 %ifarch sw_64 @@ -1608,6 +1609,7 @@ not stable, so plugins must be rebuilt any time GCC is updated. %patch -P356 -p1 %patch -P357 -p1 %patch -P358 -p1 +%patch -P359 -p1 %ifarch sw_64 %patch -P1001 -p1 @@ -4235,7 +4237,13 @@ end %doc rpm.doc/changelogs/libcc1/ChangeLog* %changelog -* Sun Mar 09 2025 huang-xiaoquan - 12.3.1-75 +* Mon Mar 10 2025 MC.5 - 12.3.1-76 +- Type:Bugfix +- ID:NA +- SUG:NA +- DESC: Fix divide-by-zero error when using 'dump-tree-tracer'. + +* Sun Mar 09 2025 huang-xiaoquan - 12.3.1-75 - Type:Bugfix - ID:NA - SUG:NA -- Gitee