From 7a583153ec27b45bd0b87b7c4defbc0d63777cda Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 27 Aug 2018 10:01:54 +0200 Subject: [PATCH] Do not read gcda files multiple times (PR gcov-profile/87069). 2018-08-27 Martin Liska PR gcov-profile/87069 * gcov.c (process_file): Record files already processed and warn about a file being processed multiple times. From-SVN: r263871 --- gcc/ChangeLog | 6 ++++++ gcc/gcov.c | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fa112074f0a..bc3f2e0da38 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-08-27 Martin Liska + + PR gcov-profile/87069 + * gcov.c (process_file): Record files already processed + and warn about a file being processed multiple times. + 2018-08-27 Martin Liska PR driver/83193 diff --git a/gcc/gcov.c b/gcc/gcov.c index 43dfc9a4b2c..ff4020c713e 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -408,6 +408,10 @@ static vector sources; /* Mapping of file names to sources */ static vector names; +/* Record all processed files in order to warn about + a file being read multiple times. */ +static vector processed_files; + /* This holds data summary information. */ static unsigned object_runs; @@ -1146,6 +1150,17 @@ static void process_file (const char *file_name) { create_file_names (file_name); + + for (unsigned i = 0; i < processed_files.size (); i++) + if (strcmp (da_file_name, processed_files[i]) == 0) + { + fnotice (stderr, "'%s' file is already processed\n", + file_name); + return; + } + + processed_files.push_back (xstrdup (da_file_name)); + read_graph_file (); read_count_file (); } -- 2.30.2