public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/11651] New: gcov aborts if empty .da files (patch attached)
@ 2003-07-23 21:38 laurent dot deniel at free dot fr
  2003-07-23 21:39 ` [Bug other/11651] " laurent dot deniel at free dot fr
  2003-07-23 22:28 ` pinskia at physics dot uc dot edu
  0 siblings, 2 replies; 3+ messages in thread
From: laurent dot deniel at free dot fr @ 2003-07-23 21:38 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11651

           Summary: gcov aborts if empty .da files (patch attached)
           Product: gcc
           Version: 3.2.3
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: laurent dot deniel at free dot fr
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: any-any-any
  GCC host triplet: any-any-any
GCC target triplet: any-any-any

Sometimes it is required to create empty .da files with appropriate
rights to be able to run the instrumented executable with different users.
But then, if some source files have not been executed, some .da files 
remain empty making gcov aborts. 

The simple fix below simply does the same thing with empty .da file as 
if the file was not present.

--- gcov.c.ori  2003-07-23 22:17:41.000000000 +0200
+++ gcov.c      2003-07-23 22:25:50.000000000 +0200
@@ -471,6 +471,18 @@
       fnotice (stderr, "Could not open data file %s.\n", da_file_name);
       fnotice (stderr, "Assuming that all execution counts are zero.\n");
     }
+
+  /* Check for empty .da file. Just assume that all execution counts are
+     zero in this case. */
+  /* Set the EOF condition if at the end of file.  */
+  ungetc (getc (da_file), da_file);
+  if (feof (da_file))
+    {
+      fnotice (stderr, "data file %s is empty.\n", da_file_name);
+      fnotice (stderr, "Assuming that all execution counts are zero.\n");
+      fclose(da_file);
+      da_file = NULL;
+    }
  
   bbg_file = fopen (bbg_file_name, "rb");
   if (bbg_file == NULL)


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

* [Bug other/11651] gcov aborts if empty .da files (patch attached)
  2003-07-23 21:38 [Bug other/11651] New: gcov aborts if empty .da files (patch attached) laurent dot deniel at free dot fr
@ 2003-07-23 21:39 ` laurent dot deniel at free dot fr
  2003-07-23 22:28 ` pinskia at physics dot uc dot edu
  1 sibling, 0 replies; 3+ messages in thread
From: laurent dot deniel at free dot fr @ 2003-07-23 21:39 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11651



------- Additional Comments From laurent dot deniel at free dot fr  2003-07-23 21:39 -------
Created an attachment (id=4468)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4468&action=view)
patch to handle empty .da file as if the .da file was not present


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

* [Bug other/11651] gcov aborts if empty .da files (patch attached)
  2003-07-23 21:38 [Bug other/11651] New: gcov aborts if empty .da files (patch attached) laurent dot deniel at free dot fr
  2003-07-23 21:39 ` [Bug other/11651] " laurent dot deniel at free dot fr
@ 2003-07-23 22:28 ` pinskia at physics dot uc dot edu
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-23 22:28 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11651


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


------- Additional Comments From pinskia at physics dot uc dot edu  2003-07-23 22:28 -------
Already fixed on the mainline (20030723).


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

end of thread, other threads:[~2003-07-23 22:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-23 21:38 [Bug other/11651] New: gcov aborts if empty .da files (patch attached) laurent dot deniel at free dot fr
2003-07-23 21:39 ` [Bug other/11651] " laurent dot deniel at free dot fr
2003-07-23 22:28 ` pinskia at physics dot uc dot edu

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