public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11773] New: GCOV misreports coverage for in-class C++ member functions
@ 2003-08-02 19:31 yuri at tsoft dot com
  2003-08-04  0:46 ` [Bug c++/11773] " pinskia at physics dot uc dot edu
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: yuri at tsoft dot com @ 2003-08-02 19:31 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=11773

           Summary: GCOV misreports coverage for in-class C++ member
                    functions
           Product: gcc
           Version: 3.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: yuri at tsoft dot com
                CC: gcc-bugs at gcc dot gnu dot org,yuri at tsoft dot com

Code (see uuencoded file src.tgz at the end of the message)
being compiled with command:
> g++ -fprofile-arcs -ftest-coverage *.cc -o tst
Then program is being run:
> ./tst
Then gcov being run:
> gcov -l a.cc
> gcov -l b.cc

WRONG RESULT OBTAINED:
in b.cc.a.h.gcov I find:
 <snip>
                void
      ######    a() {
      ######      printf("AA\n");
                }
 <snip>
this report means that function A::a() isn't used in b.cc
In fact as seen in sources it's invoked from b.cc.

Thanx,
Yuri.

--------- code ----------------------------------------------
begin 644 src.tgz
M'XL(`)X0+#\``^V644^#,!"`>>ZON.#+9A3;44;BC,GP;_A2"@K)9`N%1;/L
MOWNLFT9T\@1;LOM>#CB@38_OBBGUG=,SG$L>!@%&SL-P:N-4[N(>!Q/"YX)/
M)L+!$(3<@:#OB374IE(E@/-1E_G_]Z6E&6)"PV*P_LK3NL\QL)Y\*N71^D^$
M;-5?^$(XP/N<U($+K_]57NA%G:3@*B]SV?=IW)RR]+U*RP+6RSP!/1K/&,N+
MBKVIO!CA`:CR5=^`7A:F`IWA.E[CE?48-@Q@#FJ&(8(8GP)0GFJ>!XB]V![@
M9[=[(]@W;]FIU^(2:?R/3^R_D/YO_WWR?P@Z_&>-^0S]_$OI58D]X&7DWB+/
MA3MN>TY:GS]V_\]Z':-[_V___PDA0_)_"+Z$?S!5DB^][)$QO5#&H.P;MJKC
M1:[O;1=0^RYPT'X^M])O]UTB;N>CGWG=SC\=\ML9-8D38??_\_,_X.3_$!SW
H/^KR/^KP/^KP/R+_"8(@"((@"((@"((@"((@"*(?/@&S1(U$`"@`````
`
end


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

* [Bug c++/11773] GCOV misreports coverage for in-class C++ member functions
  2003-08-02 19:31 [Bug c++/11773] New: GCOV misreports coverage for in-class C++ member functions yuri at tsoft dot com
@ 2003-08-04  0:46 ` pinskia at physics dot uc dot edu
  2003-08-06  0:46 ` pinskia at physics dot uc dot edu
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-04  0:46 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=11773


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4                         |---


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

* [Bug c++/11773] GCOV misreports coverage for in-class C++ member functions
  2003-08-02 19:31 [Bug c++/11773] New: GCOV misreports coverage for in-class C++ member functions yuri at tsoft dot com
  2003-08-04  0:46 ` [Bug c++/11773] " pinskia at physics dot uc dot edu
@ 2003-08-06  0:46 ` pinskia at physics dot uc dot edu
  2003-08-07  7:21 ` yuri at tsoft dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-06  0:46 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=11773


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal


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

* [Bug c++/11773] GCOV misreports coverage for in-class C++ member functions
  2003-08-02 19:31 [Bug c++/11773] New: GCOV misreports coverage for in-class C++ member functions yuri at tsoft dot com
  2003-08-04  0:46 ` [Bug c++/11773] " pinskia at physics dot uc dot edu
  2003-08-06  0:46 ` pinskia at physics dot uc dot edu
@ 2003-08-07  7:21 ` yuri at tsoft dot com
  2003-08-24 22:08 ` dhazeghi at yahoo dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: yuri at tsoft dot com @ 2003-08-07  7:21 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=11773



------- Additional Comments From yuri at tsoft dot com  2003-08-07 07:21 -------
>From yuri@tsoft.com:
CORRECTION (reformulation):
After some experimentation I figured that
####### actually means "used" butwhycounter didn't appear?
Is this a bug?
In another header actual counters appeared.


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

* [Bug c++/11773] GCOV misreports coverage for in-class C++ member functions
  2003-08-02 19:31 [Bug c++/11773] New: GCOV misreports coverage for in-class C++ member functions yuri at tsoft dot com
                   ` (2 preceding siblings ...)
  2003-08-07  7:21 ` yuri at tsoft dot com
@ 2003-08-24 22:08 ` dhazeghi at yahoo dot com
  2003-08-24 22:12 ` dhazeghi at yahoo dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-08-24 22:08 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=11773



------- Additional Comments From dhazeghi at yahoo dot com  2003-08-24 22:08 -------
Created an attachment (id=4647)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4647&action=view)
testcases

Please use bugzilla's "create new attachment" to add files to bug reports,
rather than including them in the message. Not only does it make my life
easier, it also makes the audit trail more intelligible.


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

* [Bug c++/11773] GCOV misreports coverage for in-class C++ member functions
  2003-08-02 19:31 [Bug c++/11773] New: GCOV misreports coverage for in-class C++ member functions yuri at tsoft dot com
                   ` (3 preceding siblings ...)
  2003-08-24 22:08 ` dhazeghi at yahoo dot com
@ 2003-08-24 22:12 ` dhazeghi at yahoo dot com
  2003-08-24 22:16 ` nathan at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-08-24 22:12 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=11773


dhazeghi at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nathan at codesourcery dot
                   |                            |com


------- Additional Comments From dhazeghi at yahoo dot com  2003-08-24 22:12 -------
Nathan, would you mind clarify whether the reported behavior is a bug? Thanks.


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

* [Bug c++/11773] GCOV misreports coverage for in-class C++ member functions
  2003-08-02 19:31 [Bug c++/11773] New: GCOV misreports coverage for in-class C++ member functions yuri at tsoft dot com
                   ` (4 preceding siblings ...)
  2003-08-24 22:12 ` dhazeghi at yahoo dot com
@ 2003-08-24 22:16 ` nathan at gcc dot gnu dot org
  2003-09-06 18:53 ` nathan at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: nathan at gcc dot gnu dot org @ 2003-08-24 22:16 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=11773


nathan at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |nathan at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED


------- Additional Comments From nathan at gcc dot gnu dot org  2003-08-24 22:16 -------
will investigate


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

* [Bug c++/11773] GCOV misreports coverage for in-class C++ member functions
  2003-08-02 19:31 [Bug c++/11773] New: GCOV misreports coverage for in-class C++ member functions yuri at tsoft dot com
                   ` (5 preceding siblings ...)
  2003-08-24 22:16 ` nathan at gcc dot gnu dot org
@ 2003-09-06 18:53 ` nathan at gcc dot gnu dot org
  2003-11-28  8:10 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: nathan at gcc dot gnu dot org @ 2003-09-06 18:53 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=11773



------- Additional Comments From nathan at gcc dot gnu dot org  2003-09-06 18:53 -------
not a bug, but an outcome of inline functions and weak linkage. I used
the current mainline, which mangles gcov file names differently.

You'll see (well I did) that a.cc##a.h contains 2 counts
for A::a. so overall, the execution counts are correct, just not where
you expected them. What is happening is this,
1) you're compiling without optimization, thus function calls are not inlined.
2) both a.cc and b.cc need to emit a body of A::a, which they each call.
3) those A::a functions are emitted with weak linkage, which means one of them
will 'win' in the linking phase.
4) at the linking phase the A::a emitted in a.o is selected, and the call of
A::a in b.o ends up calling the body of A::a that was emitted in a.o
5) thus the body of A::a emitted in b.o is never called.

need to write something in the documentation about this.


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

* [Bug c++/11773] GCOV misreports coverage for in-class C++ member functions
  2003-08-02 19:31 [Bug c++/11773] New: GCOV misreports coverage for in-class C++ member functions yuri at tsoft dot com
                   ` (6 preceding siblings ...)
  2003-09-06 18:53 ` nathan at gcc dot gnu dot org
@ 2003-11-28  8:10 ` pinskia at gcc dot gnu dot org
  2003-12-15 14:26 ` nathan at gcc dot gnu dot org
  2003-12-15 14:29 ` cvs-commit at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-28  8:10 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |documentation
   Last reconfirmed|0000-00-00 00:00:00         |2003-11-28 08:10:49
               date|                            |


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


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

* [Bug c++/11773] GCOV misreports coverage for in-class C++ member functions
  2003-08-02 19:31 [Bug c++/11773] New: GCOV misreports coverage for in-class C++ member functions yuri at tsoft dot com
                   ` (7 preceding siblings ...)
  2003-11-28  8:10 ` pinskia at gcc dot gnu dot org
@ 2003-12-15 14:26 ` nathan at gcc dot gnu dot org
  2003-12-15 14:29 ` cvs-commit at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: nathan at gcc dot gnu dot org @ 2003-12-15 14:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From nathan at gcc dot gnu dot org  2003-12-15 14:26 -------
2003-12-15  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/11773
	* doc/gcov.texi (Gcov and Optimization): Document inline function
	behaviour. Fix some file suffixes.


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


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


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

* [Bug c++/11773] GCOV misreports coverage for in-class C++ member functions
  2003-08-02 19:31 [Bug c++/11773] New: GCOV misreports coverage for in-class C++ member functions yuri at tsoft dot com
                   ` (8 preceding siblings ...)
  2003-12-15 14:26 ` nathan at gcc dot gnu dot org
@ 2003-12-15 14:29 ` cvs-commit at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-12-15 14:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-12-15 14:29 -------
Subject: Bug 11773

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	nathan@gcc.gnu.org	2003-12-15 14:29:11

Modified files:
	gcc            : ChangeLog 
	gcc/doc        : gcov.texi 

Log message:
	PR c++/11773
	* doc/gcov.texi (Gcov and Optimization): Document inline function
	behaviour.  Fix some file suffixes.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1995&r2=2.1996
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/gcov.texi.diff?cvsroot=gcc&r1=1.18&r2=1.19



-- 


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


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

end of thread, other threads:[~2003-12-15 14:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-02 19:31 [Bug c++/11773] New: GCOV misreports coverage for in-class C++ member functions yuri at tsoft dot com
2003-08-04  0:46 ` [Bug c++/11773] " pinskia at physics dot uc dot edu
2003-08-06  0:46 ` pinskia at physics dot uc dot edu
2003-08-07  7:21 ` yuri at tsoft dot com
2003-08-24 22:08 ` dhazeghi at yahoo dot com
2003-08-24 22:12 ` dhazeghi at yahoo dot com
2003-08-24 22:16 ` nathan at gcc dot gnu dot org
2003-09-06 18:53 ` nathan at gcc dot gnu dot org
2003-11-28  8:10 ` pinskia at gcc dot gnu dot org
2003-12-15 14:26 ` nathan at gcc dot gnu dot org
2003-12-15 14:29 ` cvs-commit 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).