From: Martin Liska Date: Fri, 25 Sep 2020 08:53:26 +0000 (+0200) Subject: GCOV: do not mangle .gcno files. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f8dcbea5d2fb17dca3a7de97f15fc49997222365;p=gcc.git GCOV: do not mangle .gcno files. gcc/ChangeLog: PR gcov-profile/97193 * coverage.c (coverage_init): GCDA note files should not be mangled and should end in output directory. --- diff --git a/gcc/coverage.c b/gcc/coverage.c index f353c9c5022..7711412c3be 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -1206,6 +1206,8 @@ coverage_obj_finish (vec *ctor) void coverage_init (const char *filename) { + const char *original_filename = filename; + int original_len = strlen (original_filename); #if HAVE_DOS_BASED_FILE_SYSTEM const char *separator = "\\"; #else @@ -1277,9 +1279,9 @@ coverage_init (const char *filename) bbg_file_name = xstrdup (profile_note_location); else { - bbg_file_name = XNEWVEC (char, len + strlen (GCOV_NOTE_SUFFIX) + 1); - memcpy (bbg_file_name, filename, len); - strcpy (bbg_file_name + len, GCOV_NOTE_SUFFIX); + bbg_file_name = XNEWVEC (char, original_len + strlen (GCOV_NOTE_SUFFIX) + 1); + memcpy (bbg_file_name, original_filename, original_len); + strcpy (bbg_file_name + original_len, GCOV_NOTE_SUFFIX); } if (!gcov_open (bbg_file_name, -1))