------- 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