diff options
author | Martin Liska <mliska@suse.cz> | 2018-02-27 15:11:08 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2018-02-27 14:11:08 +0000 |
commit | e59b5e24ea78b6ca06da7ba07ec3218d6b65e989 (patch) | |
tree | 37a97e08eb0d39a05c3aab3a5b11884afbd0d816 /gcc/gcov.c | |
parent | 23c3a0590839e94c94890bb11c2e2e96c1b27f1d (diff) | |
download | gcc-e59b5e24ea78b6ca06da7ba07ec3218d6b65e989.zip gcc-e59b5e24ea78b6ca06da7ba07ec3218d6b65e989.tar.gz gcc-e59b5e24ea78b6ca06da7ba07ec3218d6b65e989.tar.bz2 |
Make groups more generic (PR gcov-profile/84548).
2018-02-27 Martin Liska <mliska@suse.cz>
PR gcov-profile/84548
* gcov.c (process_file): Allow partial overlap and consider it
also as group functions.
(output_lines): Properly calculate range of lines for a group.
2018-02-27 Martin Liska <mliska@suse.cz>
PR gcov-profile/84548
* g++.dg/gcov/pr84548.C: New test.
From-SVN: r258033
Diffstat (limited to 'gcc/gcov.c')
-rw-r--r-- | gcc/gcov.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -1151,7 +1151,6 @@ process_file (const char *file_name) function_info **slot = fn_map.get (needle); if (slot) { - gcc_assert ((*slot)->end_line == (*it)->end_line); (*slot)->is_group = 1; (*it)->is_group = 1; } @@ -2957,7 +2956,14 @@ output_lines (FILE *gcov_file, const source_info *src) { fns = src->get_functions_at_location (line_num); if (fns.size () > 1) - line_start_group = fns[0]->end_line; + { + /* It's possible to have functions that partially overlap, + thus take the maximum end_line of functions starting + at LINE_NUM. */ + for (unsigned i = 0; i < fns.size (); i++) + if (fns[i]->end_line > line_start_group) + line_start_group = fns[i]->end_line; + } else if (fns.size () == 1) { function_info *fn = fns[0]; |