public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] gcov: Fix first time gcov info dump
@ 2022-05-02  8:43 Sebastian Huber
  2022-05-02  8:50 ` Martin Liška
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Huber @ 2022-05-02  8:43 UTC (permalink / raw)
  To: gcc-patches

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.
---
 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
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-02  8:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-02  8:43 [PATCH] gcov: Fix first time gcov info dump Sebastian Huber
2022-05-02  8:50 ` Martin Liška

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).