aboutsummaryrefslogtreecommitdiff
path: root/gcc/profile.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2017-04-28 14:51:05 +0200
committerMartin Liska <marxin@gcc.gnu.org>2017-04-28 12:51:05 +0000
commit6e49961ce47b8c554ff6081ef95a68a0616f0a93 (patch)
tree581504fe21555bdbe3723111eb739d6cdc3e53ce /gcc/profile.c
parent9b9d6370d48146a0dd8ed327ecdbfc9273abf91a (diff)
downloadgcc-6e49961ce47b8c554ff6081ef95a68a0616f0a93.zip
gcc-6e49961ce47b8c554ff6081ef95a68a0616f0a93.tar.gz
gcc-6e49961ce47b8c554ff6081ef95a68a0616f0a93.tar.bz2
Make gcno more precise about BBs really belonging to a line (PR gcov-profile/79891).
2017-04-28 Martin Liska <mliska@suse.cz> PR gcov-profile/79891 * gcov.c (add_line_counts): Assign BBs to lines just if the BB is marked by compiler as living on a line. (get_cycles_count): Remove usage of the union. (output_intermediate_file): Likewise. (find_source): Fix GNU coding style. (accumulate_line_counts): Remove old non-all block mode. (output_lines): Remove usage of the union. * profile.c (output_location): Include all BBs, even if belonging to a same line (and file) as a previous BB. 2017-04-28 Martin Liska <mliska@suse.cz> PR gcov-profile/79891 * gcc.misc-tests/gcov-17.c: New test. * gcc.misc-tests/gcov-18.c: New test. From-SVN: r247374
Diffstat (limited to 'gcc/profile.c')
-rw-r--r--gcc/profile.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/gcc/profile.c b/gcc/profile.c
index c7eed0e..3346af4 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -941,29 +941,26 @@ output_location (char const *file_name, int line,
name_differs = !prev_file_name || filename_cmp (file_name, prev_file_name);
line_differs = prev_line != line;
- if (name_differs || line_differs)
+ if (!*offset)
{
- if (!*offset)
- {
- *offset = gcov_write_tag (GCOV_TAG_LINES);
- gcov_write_unsigned (bb->index);
- name_differs = line_differs=true;
- }
+ *offset = gcov_write_tag (GCOV_TAG_LINES);
+ gcov_write_unsigned (bb->index);
+ name_differs = line_differs = true;
+ }
- /* If this is a new source file, then output the
- file's name to the .bb file. */
- if (name_differs)
- {
- prev_file_name = file_name;
- gcov_write_unsigned (0);
- gcov_write_string (prev_file_name);
- }
- if (line_differs)
- {
- gcov_write_unsigned (line);
- prev_line = line;
- }
- }
+ /* If this is a new source file, then output the
+ file's name to the .bb file. */
+ if (name_differs)
+ {
+ prev_file_name = file_name;
+ gcov_write_unsigned (0);
+ gcov_write_string (prev_file_name);
+ }
+ if (line_differs)
+ {
+ gcov_write_unsigned (line);
+ prev_line = line;
+ }
}
/* Instrument and/or analyze program behavior based on program the CFG.