public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/25551]  New: gcov incorrect count for lone return in block
@ 2005-12-23 18:57 gcc-bugzilla at gcc dot gnu dot org
  2005-12-23 20:53 ` [Bug gcov/profile/25551] [4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2005-12-23 18:57 UTC (permalink / raw)
  To: gcc-bugs


        gcov incorrectly shows that a lone return statement inside a block
        has executed when in fact it has not

Environment:
System: Linux mercury.acucorp.com 2.4.18-27.8.0smp #1 SMP Fri Mar 14 07:13:13
EST 2003 i686 athlon i386 GNU/Linux
Architecture: i686


host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-4.0.2/configure --prefix=/usr/local/gcc-4.0.2

How-To-Repeat:
        Compile the following program, run it, then run gcov on the source:

        gcc -fprofile-arcs -ftest-coverage -o foo foo.c
        ./foo
        gcov -b foo.c

------- foo.c:

#include <stdio.h>

static void
foo(int num)
{
    if (num <= 1) {
        /* uncomment following line to get correct results */
//      printf("num <= 1\n");

        /* this return is never executed, but gcov says it is */
        return;
    }

    printf("num > 1\n");
} /* foo */


int
main(void)
{
    foo(3);
    foo(3);
    foo(3);
    foo(3);
    foo(3);
    foo(3);
    foo(3);
    return 0;
}

------- foo.c.gcov:

        -:    0:Source:foo.c
        -:    0:Graph:foo.gcno
        -:    0:Data:foo.gcda
        -:    0:Runs:1
        -:    0:Programs:1
        -:    1:#include <stdio.h>
        -:    2:
        -:    3:static void
        -:    4:foo(int num)
function foo called 7 returned 100% blocks executed 100%
        7:    5:{
        7:    6:    if (num <= 1) {
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        -:    7:        /* uncomment following line to get correct results */
        -:    8://      printf("num <= 1\n");
        -:    9:
        -:   10:        /* this return is never executed, but gcov says it is
*/
        7:   11:        return;
        -:   12:    }
        -:   13:
        7:   14:    printf("num > 1\n");
call    0 returned 100%
        -:   15:} /* foo */
        -:   16:
        -:   17:
        -:   18:int
        -:   19:main(void)
function main called 1 returned 100% blocks executed 100%
        1:   20:{
        1:   21:    foo(3);
call    0 returned 100%
        1:   22:    foo(3);
call    0 returned 100%
        1:   23:    foo(3);
call    0 returned 100%
        1:   24:    foo(3);
call    0 returned 100%
        1:   25:    foo(3);
call    0 returned 100%
        1:   26:    foo(3);
call    0 returned 100%
        1:   27:    foo(3);
call    0 returned 100%
        1:   28:    return 0;
        -:   29:}


------- Comment #1 from mark at acucorp dot com  2005-12-23 18:57 -------
Fix:
        unknown


-- 
           Summary: gcov incorrect count for lone return in block
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mark at acucorp dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug gcov/profile/25551] [4.0 Regression] gcov incorrect count for lone return in block
  2005-12-23 18:57 [Bug other/25551] New: gcov incorrect count for lone return in block gcc-bugzilla at gcc dot gnu dot org
@ 2005-12-23 20:53 ` pinskia at gcc dot gnu dot org
  2006-01-15 22:58 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-23 20:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2005-12-23 20:53 -------
Confirmed, only a 4.0 regression.  Works in 4.1.0 and 3.4.0.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|other                       |gcov/profile
     Ever Confirmed|0                           |1
      Known to fail|                            |4.0.2 4.0.0
      Known to work|                            |4.1.0 4.2.0
   Last reconfirmed|0000-00-00 00:00:00         |2005-12-23 20:53:05
               date|                            |
            Summary|gcov incorrect count for    |[4.0 Regression] gcov
                   |lone return in block        |incorrect count for lone
                   |                            |return in block
   Target Milestone|---                         |4.0.3


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


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

* [Bug gcov/profile/25551] [4.0 Regression] gcov incorrect count for lone return in block
  2005-12-23 18:57 [Bug other/25551] New: gcov incorrect count for lone return in block gcc-bugzilla at gcc dot gnu dot org
  2005-12-23 20:53 ` [Bug gcov/profile/25551] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2006-01-15 22:58 ` mmitchel at gcc dot gnu dot org
  2006-03-11  3:19 ` mmitchel at gcc dot gnu dot org
  2007-02-03 16:10 ` [Bug gcov-profile/25551] " gdr at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-01-15 22:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from mmitchel at gcc dot gnu dot org  2006-01-15 22:58 -------
gcov is not core functionality; P2.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug gcov/profile/25551] [4.0 Regression] gcov incorrect count for lone return in block
  2005-12-23 18:57 [Bug other/25551] New: gcov incorrect count for lone return in block gcc-bugzilla at gcc dot gnu dot org
  2005-12-23 20:53 ` [Bug gcov/profile/25551] [4.0 Regression] " pinskia at gcc dot gnu dot org
  2006-01-15 22:58 ` mmitchel at gcc dot gnu dot org
@ 2006-03-11  3:19 ` mmitchel at gcc dot gnu dot org
  2007-02-03 16:10 ` [Bug gcov-profile/25551] " gdr at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-03-11  3:19 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.3                       |4.0.4


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


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

* [Bug gcov-profile/25551] [4.0 Regression] gcov incorrect count for lone return in block
  2005-12-23 18:57 [Bug other/25551] New: gcov incorrect count for lone return in block gcc-bugzilla at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-03-11  3:19 ` mmitchel at gcc dot gnu dot org
@ 2007-02-03 16:10 ` gdr at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: gdr at gcc dot gnu dot org @ 2007-02-03 16:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from gdr at gcc dot gnu dot org  2007-02-03 16:10 -------
Fixed in GCC-4.1.0 and higher.


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.0.4                       |4.1.0


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


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

end of thread, other threads:[~2007-02-03 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-23 18:57 [Bug other/25551] New: gcov incorrect count for lone return in block gcc-bugzilla at gcc dot gnu dot org
2005-12-23 20:53 ` [Bug gcov/profile/25551] [4.0 Regression] " pinskia at gcc dot gnu dot org
2006-01-15 22:58 ` mmitchel at gcc dot gnu dot org
2006-03-11  3:19 ` mmitchel at gcc dot gnu dot org
2007-02-03 16:10 ` [Bug gcov-profile/25551] " gdr 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).