public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r9-8969] GCOV: do not mangle .gcno files.
Date: Fri,  2 Oct 2020 11:17:47 +0000 (GMT)	[thread overview]
Message-ID: <20201002111747.61629384403D@sourceware.org> (raw)

https://gcc.gnu.org/g:991a376015309ac9b413eeb97d94511908498e9a

commit r9-8969-g991a376015309ac9b413eeb97d94511908498e9a
Author: Martin Liska <mliska@suse.cz>
Date:   Fri Sep 25 10:53:26 2020 +0200

    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.
    
    (cherry picked from commit f8dcbea5d2fb17dca3a7de97f15fc49997222365)

Diff:
---
 gcc/coverage.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/gcc/coverage.c b/gcc/coverage.c
index 9be446a862d..c442e2fb008 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -1201,6 +1201,8 @@ coverage_obj_finish (vec<constructor_elt, va_gc> *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
@@ -1255,9 +1257,9 @@ coverage_init (const char *filename)
   /* Name of bbg file.  */
   if (flag_test_coverage && !flag_compare_debug)
     {
-      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))
 	{


                 reply	other threads:[~2020-10-02 11:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201002111747.61629384403D@sourceware.org \
    --to=marxin@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).