[Bug gcov-profile/30650] [Regression 4.3] ICE with -fprofile-use

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Jan 31 12:48:00 GMT 2007



------- Comment #1 from rguenth at gcc dot gnu dot org  2007-01-31 12:48 -------
Confirmed.  I'm confused by the code anyways:

      size = ((histogram->hvalue.counters[0]
              + histogram->hvalue.counters[0] / 2)
               / histogram->hvalue.counters[0]);

according to the source counter[0] is supposed to be the sum of the sizes and
counters[1] the call count.  Also all of this profiling stuff needs better
commenting.  Like

#define GCOV_COUNTER_AVERAGE    6  /* The most common difference between
                                      consecutive values of expression.  */
#define GCOV_COUNTER_IOR        7  /* The most common difference between
                                      consecutive values of expression.  */

and

        case HIST_TYPE_AVERAGE:
          hist->n_counters = 3;
          break;

(which should be 2?) as

void
__gcov_average_profiler (gcov_type *counters, gcov_type value)
{
  counters[0] += value;
  counters[1] ++;
}

suggests.

So the code in question should probably read

   if (!histogram
       || histogram->hvalue.counters[1] == 0)
    *expected_size = -1;
  else
    {
      gcov_type size;
     size = ((histogram->hvalue.counters[0]
              + histogram->hvalue.counters[0] / 2)
               / histogram->hvalue.counters[1]);


but defering to Honza who wrote all this code.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-01-31 12:48:13
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30650



More information about the Gcc-bugs mailing list