diff options
author | Martin Liska <mliska@suse.cz> | 2017-08-01 16:06:13 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2017-08-01 14:06:13 +0000 |
commit | 363a06901524d9f2e60451e2ccb9322ca784570a (patch) | |
tree | 0d79ad3f4921e12bba03ec04b2a9e8728d021df6 /gcc/gcov.c | |
parent | 0102e469f556aed64b50d71c6652baff61999485 (diff) | |
download | gcc-363a06901524d9f2e60451e2ccb9322ca784570a.zip gcc-363a06901524d9f2e60451e2ccb9322ca784570a.tar.gz gcc-363a06901524d9f2e60451e2ccb9322ca784570a.tar.bz2 |
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
Diffstat (limited to 'gcc/gcov.c')
-rw-r--r-- | gcc/gcov.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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. |