On 07/27/2017 01:48 PM, Richard Biener wrote: > On Thu, Jul 27, 2017 at 12:12 PM, Martin Liška <mli...@suse.cz> wrote: >> Hello. >> >> As reported in mentioned PR, we segfault in gcov tool when one uses -a. It's >> caused by fact >> that vectors blocks and block_lists have indices kept in sync and as one >> removes an element >> from blocks via: >> blocked.erase (it); >> >> Then calling recursively the same function breaks the synchronization. The >> patch was originally >> written by Joshua (adding him to CC). If I'm correct calling: >> >> - unblock (u, blocked, block_lists); >> >> does not make sense as we've already removed 'u'. Plus one needs to put >> content of block_lists[index] >> to a separate vector in order to not to break iteration. >> >> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. >> And fixed the problem reported in opensuse bugzilla (mentioned in the GCC >> bugzilla PR). >> >> Ready to be installed? > > Looks good to me but please wait for Joshua to confirm.
Yes. > > Did you manage to extract a testcase? Unfortunately not, I've tried to isolate the affected function and call it with various arguments. Problem is that the affected function does not have a loop and thus an inlined copy called from a loop causes that. Martin > > Thanks, > Richard. > >> Martin >> >> >> gcc/ChangeLog: >> >> 2017-07-26 Martin Liska <mli...@suse.cz> >> >> PR gcov-profile/81561 >> * gcov.c (unblock): Make unblocking safe as we need to preserve >> index correspondence of blocks and block_lists. >> --- >> gcc/gcov.c | 10 +++++++--- >> 1 file changed, 7 insertions(+), 3 deletions(-) >> >> >>