public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jerry DeLisle <jvdelisle@charter.net>
To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [patch, fortran] Bug 71686 - ICE on broken character continuation
Date: Wed, 29 Jun 2016 05:59:00 -0000	[thread overview]
Message-ID: <13f9013d-ca9e-249d-cae3-c345f9b14e41@charter.net> (raw)

I plan to commit this patch as obvious and simple.

Regression tested on x86-64.  I will provide two test cases from the PR

Regards,

Jerry

2016-06-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/71686
	* scanner.c (gfc_next_char_literal): Only decrement nextc if it
	is not NULL.

diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index 6a7a5b68..be9c5091 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -1416,7 +1416,8 @@ restart:
         {
           if (in_string)
             {
-             gfc_current_locus.nextc--;
+             if (gfc_current_locus.nextc)
+               gfc_current_locus.nextc--;
               if (warn_ampersand && in_string == INSTRING_WARN)
                 gfc_warning (OPT_Wampersand,
                              "Missing %<&%> in continued character "
@@ -1427,7 +1428,10 @@ restart:
           /* Both !$omp and !$ -fopenmp continuation lines have & on the
              continuation line only optionally.  */
           else if (openmp_flag || openacc_flag || openmp_cond_flag)
-           gfc_current_locus.nextc--;
+           {
+             if (gfc_current_locus.nextc)
+                 gfc_current_locus.nextc--;
+           }
           else
             {
               c = ' ';

                 reply	other threads:[~2016-06-29  5:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=13f9013d-ca9e-249d-cae3-c345f9b14e41@charter.net \
    --to=jvdelisle@charter.net \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@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).