public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/35882] Miscounted continuation lines when interspersed with data
Date: Wed, 09 Apr 2008 09:19:00 -0000	[thread overview]
Message-ID: <20080409091919.22702.qmail@sourceware.org> (raw)
In-Reply-To: <bug-35882-15996@http.gcc.gnu.org/bugzilla/>



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


  parent reply	other threads:[~2008-04-09  9:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-09  8:08 [Bug fortran/35882] New: " J dot Hogg at rl dot ac dot uk
2008-04-09  9:06 ` [Bug fortran/35882] " burnus at gcc dot gnu dot org
2008-04-09  9:19 ` burnus at gcc dot gnu dot org [this message]
2008-04-14  0:45 ` jvdelisle at gcc dot gnu dot org
2008-04-14  0:48 ` jvdelisle at gcc dot gnu dot org
2008-04-14  1:14 ` jvdelisle at gcc dot gnu dot org
2008-04-20 21:13 ` jvdelisle at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080409091919.22702.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).