From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11776 invoked by alias); 15 Sep 2009 12:39:55 -0000 Received: (qmail 11693 invoked by uid 48); 15 Sep 2009 12:39:37 -0000 Date: Tue, 15 Sep 2009 12:39:00 -0000 Subject: [Bug gcov-profile/41359] New: [fortran] 'else if' statement is discarded and incoherent line count X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "Edouard dot Canot at irisa dot fr" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-09/txt/msg01349.txt.bz2 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