From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22841 invoked by alias); 9 Apr 2008 09:19:56 -0000 Received: (qmail 22703 invoked by uid 48); 9 Apr 2008 09:19:19 -0000 Date: Wed, 09 Apr 2008 09:19:00 -0000 Message-ID: <20080409091919.22702.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/35882] Miscounted continuation lines when interspersed with data In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus at gcc dot gnu dot org" 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: 2008-04/txt/msg00682.txt.bz2 ------- Comment #2 from burnus at gcc dot gnu dot org 2008-04-09 09:19 ------- > We found the bug when using a very long write statement, with alternating > continuation lines of string literals and data. The bug does not appear if > only string literals are used. I forget to say thank you for the bug report. The problem that the number miscounts for comment/empty lines should be fixed by the following patch (untested), but I did not see the actual problem. ... I think it is caused by repeatedly parsing the same line; one could try to fix it as follows: Index: scanner.c =================================================================== --- scanner.c (revision 134131) +++ scanner.c (working copy) @@ -811,18 +811,19 @@ restart: /* We've got a continuation line. If we are on the very next line after the last continuation, increment the continuation line count and check whether the limit has been exceeded. */ - if (gfc_linebuf_linenum (gfc_current_locus.lb) == continue_line + 1) + if (gfc_linebuf_linenum (gfc_current_locus.lb) > continue_line) { if (++continue_count == gfc_option.max_continue_free) { if (gfc_notification_std (GFC_STD_GNU) || pedantic) gfc_warning ("Limit of %d continuations exceeded in " "statement at %C", gfc_option.max_continue_free); } + + continue_line = gfc_linebuf_linenum (gfc_current_locus.lb); } - continue_line = gfc_linebuf_linenum (gfc_current_locus.lb); /* Now find where it continues. First eat any comment lines. */ openmp_cond_flag = skip_free_comments (); -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35882