From b5f58440d2eee04513ef790514354825e5cf41b5 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Wed, 29 Jun 2016 18:48:37 +0000 Subject: [PATCH] re PR fortran/71686 (ICE on broken character continuation) 2016-06-29 Jerry DeLisle PR fortran/71686 * scanner.c (gfc_next_char_literal): Only decrement nextc if it is not NULL. From-SVN: r237860 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/scanner.c | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 8c91f183a32..6ac8eafb667 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2016-06-29 Jerry DeLisle + + PR fortran/71686 + * scanner.c (gfc_next_char_literal): Only decrement nextc if it + is not NULL. + 2016-06-29 Cesar Philippidis * openmp.c (match_oacc_clause_gang): Rename to ... diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index 6a7a5b68bb3..be9c5091ea8 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 = ' '; -- 2.30.2