profile.c (compute_value_histograms): Do not ICE when there is mismatch only on some...
authorJan Hubicka <jh@suse.cz>
Tue, 30 Jul 2013 12:00:42 +0000 (14:00 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 30 Jul 2013 12:00:42 +0000 (12:00 +0000)
* profile.c (compute_value_histograms): Do not ICE when
there is mismatch only on some counters.

Co-Authored-By: Martin Liska <marxin.liska@gmail.com>
From-SVN: r201333

gcc/ChangeLog
gcc/profile.c

index d073a190471464108b3315d5c492fa9800e90398..b99e074067c90bb0edea9df66009532d9c3347bc 100644 (file)
@@ -1,3 +1,9 @@
+2013-07-30  Jan Hubicka  <jh@suse.cz>
+           Martin Liska  <marxin.liska@gmail.com>
+
+       * profile.c (compute_value_histograms): Do not ICE when
+       there is mismatch only on some counters.
+
 2013-07-30  Zhenqiang Chen  <zhenqiang.chen@linaro.org>
 
        PR rtl-optimization/57637
index b8333987e02ad24d1504cbbc55e0b4c5e223d712..4ad7c9f3ab1e3d48c6c9985c1af0053c85ec6991 100644 (file)
@@ -885,12 +885,16 @@ compute_value_histograms (histogram_values values, unsigned cfg_checksum,
       t = (int) hist->type;
 
       aact_count = act_count[t];
-      act_count[t] += hist->n_counters;
+      if (act_count[t])
+        act_count[t] += hist->n_counters;
 
       gimple_add_histogram_value (cfun, stmt, hist);
       hist->hvalue.counters =  XNEWVEC (gcov_type, hist->n_counters);
       for (j = 0; j < hist->n_counters; j++)
-       hist->hvalue.counters[j] = aact_count[j];
+        if (aact_count[t])
+         hist->hvalue.counters[j] = aact_count[j];
+       else
+         hist->hvalue.counters[j] = 0;
     }
 
   for (t = 0; t < GCOV_N_VALUE_COUNTERS; t++)