re PR fortran/64506 (FORMAT Parse Error with Continuation Line)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Fri, 13 Feb 2015 16:57:28 +0000 (16:57 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Fri, 13 Feb 2015 16:57:28 +0000 (16:57 +0000)
2015-02-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR fortran/64506
* scanner.c (gfc_next_char_literal): For free form source,
check for '!' and if found, clear the comment and go back
and get the next character. For fixed form source, skip the
rest of the line.

From-SVN: r220687

gcc/fortran/ChangeLog
gcc/fortran/scanner.c

index bff0cb6454ae3b134ca1a9a03f56ab5b587f7080..b6dd48089e93c9a35159f82b8c5113fc94ebb536 100644 (file)
@@ -1,3 +1,11 @@
+2015-02-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/64506
+       * scanner.c (gfc_next_char_literal): For free form source,
+       check for '!' and if found, clear the comment and go back
+       and get the next character. For fixed form source, skip the
+       rest of the line.
+
 2015-02-12  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/64932
index 4389880b3b7f989d0ee3eda853036657b0b6671e..f0e6404c6254ac355c2562becf6a8ace7dfda227 100644 (file)
@@ -1268,13 +1268,25 @@ restart:
        c = next_char ();
 
       /* Character constants to be continued cannot have commentary
-        after the '&'.  */
+        after the '&'. However, there are cases where we may think we
+        are still in a string and we are looking for a possible
+        doubled quote and we end up here. See PR64506.  */
 
-      if (in_string && c != '\n')
+      if (in_string)
        {
          gfc_current_locus = old_loc;
-         c = '&';
-         goto done;
+
+         if (c == '!')
+           {
+             skip_comment_line ();
+             goto restart;
+           }
+
+         if (c != '\n')
+           {
+             c = '&';
+             goto done;
+           }
        }
 
       if (c != '!' && c != '\n')
@@ -1395,7 +1407,7 @@ restart:
   else /* Fixed form.  */
     {
       /* Fixed form continuation.  */
-      if (!in_string && c == '!')
+      if (in_string != INSTRING_WARN && c == '!')
        {
          /* Skip comment at end of line.  */
          do