public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* GCov showing closing braces as not executed between gcc 4.4.4 and 4.6.3
@ 2012-12-14 23:14 Graeme Bunyan
  0 siblings, 0 replies; only message in thread
From: Graeme Bunyan @ 2012-12-14 23:14 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 2766 bytes --]

Hi,

The output from gcov (compiled with -g, no optimization) shows some 
closing braces as not being highlighted - I've put together a minimal 
testcase (attached), and testing this with the other versions of gcc I 
have access to, it appears to have been introduced in 4.4.4, and 
resolved sometime before 4.6.3.  Unfortunately, I'm stuck on 4.4.5 for 
at least the next year, so I can't simply switch to a later release to 
get the fix.  I searched through all of the release notes for gcc since 
4.4, and had a look at the bugs fixed in each release in Bugzilla, but 
I'm afraid nothing leaps out at me as being the culprit.

I actually used to see this exact same behavior in 4.4.3 and prior iff 
the code was compiled with -O, so I'm wondering if maybe some 
optimization flag was turned on by default in 4.4.4, and then reverted 
sometime before 4.6.3 (in which case, hopefully I can work around it by 
supplying a flag to gcc)?

I'd appreciate any help in narrowing down the culprit to a particular 
bug report - if it's minor enough, it may be something I can have 
integrated into our 4.4.5 builds.  Minimally, at least I'll know in 
which release this is fixed.

The testcase is fairly straightforward - simply unzip and type 'make', 
and it will compile the test with '-g --coverage', run the exe, run gcov 
on one of the source files, and cat the output from gcov.  The problem 
is the closing brace in the constructor:

         1:    5:SubClass::SubClass()
         -:    6:{
         -:    7:    // Certain calls within this function result in gcov
         -:    8:    // reporting the line with the closing brace for this
         -:    9:    // function as not executed ('#####'). The first two
         -:   10:    // exhibit the problem, the other two do not.
         -:   11:
         -:   12:    // (Problem) Call static member of another class
         -:   13: //UnrelatedClass::unrelatedTestFunction();
         -:   14:    // (Problem) Call superclass member function
         1:   15:    superTestFunction();
         -:   16:    // (Ok) Call member of this class
         -:   17:    // subTestFunction();
         -:   18:    // (Ok) Call plain ol' C function
         -:   19:    // rand();
#####:   20:}

It isn't always a problem - calling a member defined within the same 
class (ie. not inherited from a superclass) is fine, as is calling a 
non-member C function like rand().   Calling a member of another class, 
however - even if it's a superclass of the current class - exhibits the 
problem.  In the releases I've tested which don't exhibit this bug, this 
line shows as executed with the same count as the other lines in the 
same function.

Any information on this would be very much appreciated :)

Best regards,
Graeme.


[-- Attachment #2: GCovTest.tar.bz2 --]
[-- Type: application/x-bzip, Size: 1269 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-12-14 23:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-14 23:14 GCov showing closing braces as not executed between gcc 4.4.4 and 4.6.3 Graeme Bunyan

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