summaryrefslogtreecommitdiff
path: root/gcc/profile.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-21 15:04:45 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-21 15:04:45 +0000
commit8dd7dbd1a1bd40f89d7ce5d2e3209e2145b6abdc (patch)
tree774fe87fcbefd0504aa31e0ac71f76fae242e13c /gcc/profile.c
parent413929725e50d50f5b4a7d98ebdfd5fcf562a820 (diff)
downloadgcc-8dd7dbd1a1bd40f89d7ce5d2e3209e2145b6abdc.tar.gz
PR gcov-profile/55417
* profile.c (compute_working_sets): Check index first to avoid out-of-bounds array access. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193697 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/profile.c')
-rw-r--r--gcc/profile.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/profile.c b/gcc/profile.c
index 194ef91f24f..bbe02b1f00a 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -288,11 +288,11 @@ compute_working_sets (void)
else
tmp_cum = cum + histo_bucket->cum_value;
- /* Next walk through successive working set entries and fill in
- the statistics for any whose size we have reached by accumulating
- this histogram counter. */
- while (tmp_cum >= working_set_cum_values[ws_ix]
- && ws_ix < NUM_GCOV_WORKING_SETS)
+ /* Next walk through successive working set entries and fill in
+ the statistics for any whose size we have reached by accumulating
+ this histogram counter. */
+ while (ws_ix < NUM_GCOV_WORKING_SETS
+ && tmp_cum >= working_set_cum_values[ws_ix])
{
gcov_working_sets[ws_ix].num_counters = count;
gcov_working_sets[ws_ix].min_counter