From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22145 invoked by alias); 4 Aug 2002 15:26:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 22044 invoked by uid 71); 4 Aug 2002 15:26:00 -0000 Resent-Date: 4 Aug 2002 15:26:00 -0000 Resent-Message-ID: <20020804152600.22042.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, xela@slit.de Received: (qmail 21919 invoked by uid 61); 4 Aug 2002 15:24:16 -0000 Message-Id: <20020804152416.21918.qmail@sources.redhat.com> Date: Sun, 04 Aug 2002 08:26:00 -0000 From: xela@slit.de Reply-To: xela@slit.de To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: fortran/7488: wrong line numbers after INCLUDE (resubmission) X-SW-Source: 2002-08/txt/msg00068.txt.bz2 List-Id: >Number: 7488 >Category: fortran >Synopsis: wrong line numbers after INCLUDE (resubmission) >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Sun Aug 04 08:26:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: xela@slit.de >Release: gcc 2.95.3 (SuSE), gcc 3.0.1 (SuSE), gcc 3.1 (vanilla) >Organization: >Environment: no special hardware type (same on Intel, PPC, ...) >Description: A source file 'main.f' INCLUDEs a file 'second.f' that itself INCLUDEs 'third.f'. The contents of 'main.f' and 'third.f' don't matter much. If 'second.f' has the INCLUDE 'third.f' statement as the last line of the source (or nothing but empty lines follow it), the line numbers are wrong in 'main.f' after the INCLUDE 'second.f' statement. This affects both debugging (GDB) as well as G77 error and warning messages for lines in 'main.f'. It seems that the line numbering after an INCLUDE is generally wrong if there's nothing in the same file after the INCLUDE. However, normally that just means there are no more lines, and it will not show up. If the including file itself is included, however, it does (as above), as lines will follow in the original including file ('main.f'). The error in line numbering depends on the size of the file 'third.f', ie the more lines it has, the worse the error. >How-To-Repeat: Eg use the following source files: (the 'syntax error' line simply causes an error message) --------(main.f)---------------- include 'second.f' end syntax error --------(second.f)-------------- include 'third.f' --------(third.f)--------------- ! nothing special, may be empty, ! but the more lines this has, ! the worse the error in line ! numbering... ! ! ! ! ! -------------------------------- Then simply run g77 main.f and you'll get something like main.f:14: syntax error 1 2 Unrecognized statement name at (1) and invalid form for assignment or statement-function definition at (2) (note '14') even though the file 'main.f' has just 3 lines of code. Similarly, when using '-g', GDB will show the wrong parts of the source code. >Fix: I have not looked at the compiler sources. An intermediate fix is to put some line of code (*not* a comment) after the INCLUDE 'third.f' statement in 'second.f', *AND* another line with at least a space or at least two empty lines after that line of code. In another situation, when using '-ffree-form', even a *comment* did work. So this fix may depend on whether using fix or free form. >Release-Note: >Audit-Trail: >Unformatted: