Fix segfault in gcov.c (PR gcov-profile/81561).

2017-08-01  Martin Liska  <mliska@suse.cz>

	PR gcov-profile/81561
	* gcov.c (unblock): Make unblocking safe as we need to preserve
	index correspondence of blocks and block_lists.

From-SVN: r250780
This commit is contained in:
Martin Liska 2017-08-01 16:06:13 +02:00 committed by Martin Liska
parent 0102e469f5
commit 363a069015
2 changed files with 11 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2017-08-01 Martin Liska <mliska@suse.cz>
PR gcov-profile/81561
* gcov.c (unblock): Make unblocking safe as we need to preserve
index correspondence of blocks and block_lists.
2017-08-01 Richard Biener <rguenther@suse.de>
PR tree-optimization/81181

View File

@ -539,13 +539,13 @@ unblock (const block_t *u, block_vector_t &blocked,
unsigned index = it - blocked.begin ();
blocked.erase (it);
for (block_vector_t::iterator it2 = block_lists[index].begin ();
it2 != block_lists[index].end (); it2++)
unblock (*it2, blocked, block_lists);
for (unsigned j = 0; j < block_lists[index].size (); j++)
unblock (u, blocked, block_lists);
block_vector_t to_unblock (block_lists[index]);
block_lists.erase (block_lists.begin () + index);
for (block_vector_t::iterator it = to_unblock.begin ();
it != to_unblock.end (); it++)
unblock (*it, blocked, block_lists);
}
/* Find circuit going to block V, PATH is provisional seen cycle.