On 5/2/22 10:43, Sebastian Huber wrote:
> This patch fixes an issue introduced by commit
> ef9a53feae5701953da9161afef2aea0329ec8b2:

Works for me, please install it.

Martin

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

Reply via email to