]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fortran - fix whitespace issue during parsing of assigned goto
authorHarald Anlauf <anlauf@gmx.de>
Mon, 30 Aug 2021 21:07:56 +0000 (23:07 +0200)
committerHarald Anlauf <anlauf@gmx.de>
Fri, 3 Sep 2021 19:07:06 +0000 (21:07 +0200)
gcc/fortran/ChangeLog:

PR fortran/102113
* match.c (gfc_match_goto): Allow for whitespace in parsing list
of labels.

gcc/testsuite/ChangeLog:

PR fortran/102113
* gfortran.dg/goto_9.f90: New test.

(cherry picked from commit a7083b83e45852540a4a09ee11b74dc28d777399)

gcc/fortran/match.c
gcc/testsuite/gfortran.dg/goto_9.f90 [new file with mode: 0644]

index 247f686ee38e34116812b48c9f144d81673c7384..bccc85df87aaacb727991cddc333d42777fff520 100644 (file)
@@ -4079,7 +4079,7 @@ gfc_match_goto (void)
        }
       while (gfc_match_char (',') == MATCH_YES);
 
-      if (gfc_match (")%t") != MATCH_YES)
+      if (gfc_match (" )%t") != MATCH_YES)
        goto syntax;
 
       if (head == NULL)
diff --git a/gcc/testsuite/gfortran.dg/goto_9.f90 b/gcc/testsuite/gfortran.dg/goto_9.f90
new file mode 100644 (file)
index 0000000..e05e738
--- /dev/null
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! { dg-options "-std=legacy" }
+! PR fortran/102113 - parsing error in assigned goto
+
+program p
+   assign 10 to i
+   goto i,(10,20 )
+10 continue
+20 continue
+end