public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug gcov-profile/41359]  New: [fortran] 'else if' statement is discarded and incoherent line count
@ 2009-09-15 12:39 Edouard dot Canot at irisa dot fr
  2010-04-10 19:04 ` [Bug fortran/41359] Wrong line numbers for debugging/profiling jv244 at cam dot ac dot uk
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Edouard dot Canot at irisa dot fr @ 2009-09-15 12:39 UTC (permalink / raw)
  To: gcc-bugs

Considering the following fortran code:

=== begin code ===
program main

   implicit none

   integer :: a = 7

   if( a == 0 ) then
      print *, "a is null"
   else if( a > 0 ) then
      print *, "a is positif"
   else
      print *, "a is negatif"
   end if

end program
=== end code ===

compiled with the "-fprofile-arcs -ftest-coverage" option flags,
linked with the same flags, with gfortran-4.3.4 or gfortran-4.4.1

After a single execution, the profile file is built as usual with:
$ gcov main

The resulting profile is then:

$ cat main.f90.gcov
        -:    0:Source:main.f90
        -:    0:Graph:main.gcno
        -:    0:Data:main.gcda
        -:    0:Runs:1
        -:    0:Programs:1
        1:    1:program main
        -:    2:
        -:    3:   implicit none
        -:    4:
        -:    5:   integer :: a = 7
        -:    6:
        3:    7:   if( a == 0 ) then
    #####:    8:      print *, "a is null"
        -:    9:   else if( a > 0 ) then
        1:   10:      print *, "a is positif"
        -:   11:   else
    #####:   12:      print *, "a is negatif"
        -:   13:   end if
        -:   14:
        -:   15:end program

First remark: line 7 is marked '3' instead of '1'

Second remark: line 9 is discarded (marked '-') instead of '1'





When using the current snapshot of gfortran-4.5 (2009-09-15), the
result is slightly different:

$ cat main.f90.gcov
        -:    0:Source:main.f90
        -:    0:Graph:main.gcno
        -:    0:Data:main.gcda
        -:    0:Runs:1
        -:    0:Programs:1
        1:    1:program main
        -:    2:
        -:    3:   implicit none
        -:    4:
        -:    5:   integer :: a = 7
        -:    6:
        2:    7:   if( a == 0 ) then
    #####:    8:      print *, "a is null"
        -:    9:   else if( a > 0 ) then
        1:   10:      print *, "a is positif"
        -:   11:   else
    #####:   12:      print *, "a is negatif"
        -:   13:   end if
        -:   14:
        2:   15:end program

Note that line 7 is counted twice, as well as the last line !


-- 
           Summary: [fortran] 'else if' statement is discarded and
                    incoherent line count
           Product: gcc
           Version: 4.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Edouard dot Canot at irisa dot fr
 GCC build triplet: i686-linux-gnu
  GCC host triplet: i686-linux-gnu
GCC target triplet: i686-linux-gnu


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


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

end of thread, other threads:[~2011-02-22 10:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-41359-4@http.gcc.gnu.org/bugzilla/>
2010-10-13 11:39 ` [Bug fortran/41359] Wrong line numbers for debugging/profiling Joost.VandeVondele at pci dot uzh.ch
2010-10-13 19:05 ` mikael.morin at sfr dot fr
     [not found] ` <20101013113915.02AC61C00093@msfrf2109.sfr.fr>
2010-10-13 19:05   ` Mikael Morin
2010-10-16 19:00 ` tkoenig at gcc dot gnu.org
2010-12-21 21:18 ` tkoenig at gcc dot gnu.org
2011-02-21 22:41 ` burnus at gcc dot gnu.org
2011-02-22 10:31 ` burnus at gcc dot gnu.org
2011-02-22 10:36 ` burnus at gcc dot gnu.org
2011-02-22 10:47 ` Edouard.Canot at irisa dot fr
2009-09-15 12:39 [Bug gcov-profile/41359] New: [fortran] 'else if' statement is discarded and incoherent line count Edouard dot Canot at irisa dot fr
2010-04-10 19:04 ` [Bug fortran/41359] Wrong line numbers for debugging/profiling jv244 at cam dot ac dot uk
2010-04-10 21:27 ` mikael at gcc dot gnu dot org
2010-04-11 18:03 ` jv244 at cam dot ac dot uk
2010-07-28 20:01 ` mikael 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).