From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12297 invoked by alias); 17 Jul 2012 12:38:06 -0000 Received: (qmail 12283 invoked by uid 22791); 17 Jul 2012 12:38:05 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED 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; Tue, 17 Jul 2012 12:37:53 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/53993] gfortran ignores file part of #line directives for debugging Date: Tue, 17 Jul 2012 12:38:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: 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 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: 2012-07/txt/msg01308.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53993 --- Comment #2 from Tobias Burnus 2012-07-17 12:37:52 UTC --- Okay, I think I understand: #include "myfile.f90" gets translated (cpp) into # 1 "myfile.f90" 1 ... content of that file ... # 8 "myfile.f90" 2 Where "1" is the first line of "file" and "8" is the line, in the main file, after the #include. However, '#line 1234 "file"' gets translated into a simple: # 1234 "file" And the scanner.c code seemingly doesn't handle the case of having no number after the string. The following feels a bit hackish, but it works. I think the function could do with some more comments. --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -1728,2 +1728,8 @@ preprocessor_line (gfc_char_t *c) + if (! *c) + { + flag[1] = true; + goto process; + } + for (;;) @@ -1741,2 +1747,3 @@ preprocessor_line (gfc_char_t *c) +process: /* Convert the filename in wide characters into a filename in narrow