From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14973 invoked by alias); 21 Feb 2011 21:48:12 -0000 Received: (qmail 14947 invoked by uid 22791); 21 Feb 2011 21:48:10 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_TM X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 21 Feb 2011 21:48:06 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/41359] Wrong line numbers for debugging/profiling X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: patch, wrong-debug X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Mon, 21 Feb 2011 22:41:00 -0000 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: 2011-02/txt/msg02529.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41359 --- Comment #9 from Tobias Burnus 2011-02-21 21:47:59 UTC --- I think the current gcov output is OK: 1: 1:program main -: 2: implicit none -: 3: integer :: a = 7 1: 4: if( a == 0 ) then #####: 5: print *, "a is null" 1: 6: else if( a > 0 ) then 1: 7: print *, "a is positif" -: 8: else #####: 9: print *, "a is negatif" -: 10: end if 2: 11:end program Though the following is still partially wrong: [foo.f90 : 6] if ([foo.f90 : 5] a > 0) With patch: [foo.f90 : 6] if ([foo.f90 : 6] a > 0) --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -718,6 +718,7 @@ gfc_trans_if_1 (gfc_code * code) { gfc_se if_se; tree stmt, elsestmt; + locus saved_loc; location_t loc; /* Check for an unconditional ELSE clause. */ @@ -729,7 +730,10 @@ gfc_trans_if_1 (gfc_code * code) gfc_start_block (&if_se.pre); /* Calculate the IF condition expression. */ + gfc_save_backend_locus (&saved_loc); + gfc_set_backend_locus (&code->expr1->where); gfc_conv_expr_val (&if_se, code->expr1); + gfc_restore_backend_locus (&saved_loc); /* Translate the THEN clause. */ stmt = gfc_trans_code (code->next);