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; 5+ 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] 5+ 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; 5+ 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] 5+ 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; 5+ 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] 5+ messages in thread

* [Bug other/11651] gcov aborts if empty .da files (patch attached)
       [not found] <bug-11651-6580@http.gcc.gnu.org/bugzilla/>
  2006-08-01 20:55 ` laurent dot deniel at free dot fr
@ 2006-08-15 18:29 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-15 18:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-08-15 18:29 -------
And this was fixed again for 4.2.0.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|3.4.0                       |4.2.0


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


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

* [Bug other/11651] gcov aborts if empty .da files (patch attached)
       [not found] <bug-11651-6580@http.gcc.gnu.org/bugzilla/>
@ 2006-08-01 20:55 ` laurent dot deniel at free dot fr
  2006-08-15 18:29 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 5+ messages in thread
From: laurent dot deniel at free dot fr @ 2006-08-01 20:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from laurent dot deniel at free dot fr  2006-08-01 20:55 -------
Newer gcc/gcov version (3.4.5 and 4) again changed the behavior, it is no
longer possible to do gcov if :

- the .gcda file is empty
- there is no .gcda file

In the later case at least, gcov invoked on the .c (not the .gcda) should
do the same as with previous gcc v3 releases : it should create a .c.gcov
file without any executed line ...


-- 

laurent dot deniel at free dot fr changed:

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


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


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

end of thread, other threads:[~2006-08-15 18:29 UTC | newest]

Thread overview: 5+ 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
     [not found] <bug-11651-6580@http.gcc.gnu.org/bugzilla/>
2006-08-01 20:55 ` laurent dot deniel at free dot fr
2006-08-15 18:29 ` pinskia at gcc dot gnu dot org

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