public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16855] New: gcov does not report the fact that static destructors actually run.
@ 2004-08-02 21:14 wallguide-software at yahoo dot com
  2004-08-02 21:17 ` [Bug c++/16855] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: wallguide-software at yahoo dot com @ 2004-08-02 21:14 UTC (permalink / raw)
  To: gcc-bugs

If you compile a c++ program that has static objects with the -fprofile-arcs -
ftest-coverage switches and link with -lgcov, then run the program and produce 
a report with gcov, then static destructors are reported not to have run.
These destructors do in fact run, its just that gcov doesn't detect them.

I'm running djgpp 3.4.1 under Windows XP.
The program below is compiled using the batch file and the gcov output is 
shown below that.

Example program:
===============
// Test constructors/destructors:
#include <iostream>
using namespace std;
class Test {
public:
	Test(void){
	cout<< "In Test ctor" << endl;
	}
	~Test(void){
	cout<< "In Test dtor" << endl;
	}
}T1;

void uncalled(void){
	cout<< "In uncalled" << endl;
}
int main(void){
// Test T2;
cout<< "In main" << endl;
return 0;
}
===============

Testctor.bat:
===============
gpp -o testctor.exe testctor.cpp -fprofile-arcs -ftest-coverage -lgcov
testctor.exe
gcov testctor.cpp
===============
which shows how I compiled the above source file, ran the resulting program 
and ran gcov to produce a .gcov output.

testctor.cpp.gcov
===============
        -:    0:Source:testctor.cpp
        -:    0:Graph:testctor.gcno
        -:    0:Data:testctor.gcda
        -:    0:Runs:1
        -:    0:Programs:1
        -:    1:// Test constructors/destructors:
        -:    2:#include <iostream>
        -:    3:using namespace std;
        -:    4:class Test {
        -:    5:public:
function _ZN4TestC1Ev called 1 returned 100% blocks executed 100%
        1:    6:	Test(void){
        1:    7:	cout<< "In Test ctor" << endl;
        -:    8:	}
function _ZN4TestD1Ev called 0 returned 0% blocks executed 0%
    #####:    9:	~Test(void){
    #####:   10:	cout<< "In Test dtor" << endl;
        -:   11:	}
        1:   12:}T1;
        -:   13:
function _Z8uncalledv called 0 returned 0% blocks executed 0%
    #####:   14:void uncalled(void){
    #####:   15:	cout<< "In uncalled" << endl;
        -:   16:}
function main called 1 returned 100% blocks executed 100%
        1:   17:int main(void){
        -:   18:// Test T2;
        1:   19:cout<< "In main" << endl;
        1:   20:return 0;
function _Z41__static_initialization_and_destruction_0ii called 1 returned 
100% blocks executed 76%
        2:   21:}
function _GLOBAL__I_T1 called 1 returned 100% blocks executed 100%
        2:   22:/*EOF*/
function _GLOBAL__D_T1 called 0 returned 0% blocks executed 0%
    #####:   23:/*EOF*/
===============

-- 
           Summary: gcov does not report the fact that static destructors
                    actually run.
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wallguide-software at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/16855] gcov does not report the fact that static destructors actually run.
  2004-08-02 21:14 [Bug c++/16855] New: gcov does not report the fact that static destructors actually run wallguide-software at yahoo dot com
@ 2004-08-02 21:17 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-02 21:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-02 21:17 -------


*** This bug has been marked as a duplicate of 7970 ***

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


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


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

end of thread, other threads:[~2004-08-02 21:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-02 21:14 [Bug c++/16855] New: gcov does not report the fact that static destructors actually run wallguide-software at yahoo dot com
2004-08-02 21:17 ` [Bug c++/16855] " 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).