ChangeLog rotatation and copyright year update
[deliverable/binutils-gdb.git] / gprof / hist.c
index 25364b215e823fe633a7823f0d7a895db547a3ee..058ef3f33ae199e880dbe0d71c88b5eebb21ca4c 100644 (file)
@@ -1,7 +1,6 @@
 /* hist.c  -  Histogram related operations.
 
-   Copyright 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2009
-   Free Software Foundation, Inc.
+   Copyright (C) 1999-2015 Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
@@ -365,13 +364,13 @@ hist_assign_samples_1 (histogram *r)
   bfd_vma sym_low_pc, sym_high_pc;
   bfd_vma overlap, addr;
   unsigned int bin_count;
-  unsigned int i, j;
+  unsigned int i, j, k;
   double count_time, credit;
 
   bfd_vma lowpc = r->lowpc / sizeof (UNIT);
 
   /* Iterate over all sample bins.  */
-  for (i = 0, j = 1; i < r->num_bins; ++i)
+  for (i = 0, k = 1; i < r->num_bins; ++i)
     {
       bin_count = r->sample[i];
       if (! bin_count)
@@ -389,8 +388,11 @@ hist_assign_samples_1 (histogram *r)
                    bin_count));
       total_time += count_time;
 
-      /* Credit all symbols that are covered by bin I.  */
-      for (j = j - 1; j < symtab.len; ++j)
+      /* Credit all symbols that are covered by bin I.
+
+         PR gprof/13325: Make sure that K does not get decremented
+        and J will never be less than 0.  */
+      for (j = k - 1; j < symtab.len; k = ++j)
        {
          sym_low_pc = symtab.base[j].hist.scaled_addr;
          sym_high_pc = symtab.base[j + 1].hist.scaled_addr;
This page took 0.024036 seconds and 4 git commands to generate.