public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Sebastian Huber <sh@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-67] gcov: Fix first time gcov info dump
Date: Mon,  2 May 2022 08:52:29 +0000 (GMT)	[thread overview]
Message-ID: <20220502085229.CD69F385800E@sourceware.org> (raw)

https://gcc.gnu.org/g:880a9845dc126e10ceb07b846d5a4c5b167b5185

commit r13-67-g880a9845dc126e10ceb07b846d5a4c5b167b5185
Author: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date:   Mon May 2 08:44:16 2022 +0200

    gcov: Fix first time gcov info dump
    
    This patch fixes an issue introduced by commit
    ef9a53feae5701953da9161afef2aea0329ec8b2:
    
    gcc --coverage main.c && ./a.out
    libgcov profiling error:a-main.gcda:Error writing
    
    gcc/ChangeLog:
    
            * gcov-io.cc (gcov_rewrite):  Clear the file error status.

Diff:
---
 gcc/gcov-io.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/gcov-io.cc b/gcc/gcov-io.cc
index fdf745e6ce1..62032ccfa18 100644
--- a/gcc/gcov-io.cc
+++ b/gcc/gcov-io.cc
@@ -79,11 +79,14 @@ gcov_is_error (void)
 }
 
 #if IN_LIBGCOV
-/* Move to beginning of file and initialize for writing.  */
+/* Move to beginning of file, initialize for writing, and clear file error
+   status.  */
+
 GCOV_LINKAGE inline void
 gcov_rewrite (void)
 {
   gcov_var.mode = -1; 
+  gcov_var.error = GCOV_FILE_NO_ERROR;
   fseek (gcov_var.file, 0L, SEEK_SET);
 }
 #endif


                 reply	other threads:[~2022-05-02  8:52 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=20220502085229.CD69F385800E@sourceware.org \
    --to=sh@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).