]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fortran: parsing issue with DO CONCURRENT;ENDDO on same line [PR120179]
authorHarald Anlauf <anlauf@gmx.de>
Thu, 8 May 2025 20:21:03 +0000 (22:21 +0200)
committerHarald Anlauf <anlauf@gmx.de>
Thu, 8 May 2025 20:25:19 +0000 (22:25 +0200)
PR fortran/120179

gcc/fortran/ChangeLog:

* match.cc (gfc_match_do): Do not attempt to match end-of-statement
twice.

gcc/testsuite/ChangeLog:

* gfortran.dg/do_concurrent_basic.f90: Extend testcase.

gcc/fortran/match.cc
gcc/testsuite/gfortran.dg/do_concurrent_basic.f90

index 474ba81b2aa09f4ff8a2db556d79b9c599d1acf7..a99a757bede60886fe41d258c42e1494fcdea357 100644 (file)
@@ -2892,7 +2892,7 @@ gfc_match_do (void)
          locus where = gfc_current_locus;
 
          if (gfc_match_eos () == MATCH_YES)
-           break;
+           goto concurr_ok;
 
          else if (gfc_match ("local ( ") == MATCH_YES)
            {
@@ -3141,6 +3141,7 @@ gfc_match_do (void)
       if (gfc_match_eos () != MATCH_YES)
        goto concurr_cleanup;
 
+concurr_ok:
       if (label != NULL
           && !gfc_reference_st_label (label, ST_LABEL_DO_TARGET))
        goto concurr_cleanup;
index fe8723d48b4c389f8066728e43a0d588f20f03e3..bdb6e0e6fe21f6f7f0534a492e2eb80ed2ca96af 100644 (file)
@@ -1,4 +1,4 @@
-! { dg-do run }
+! { dg-do compile }
 program basic_do_concurrent
   implicit none
   integer :: i, arr(10)
@@ -7,5 +7,8 @@ program basic_do_concurrent
     arr(i) = i
   end do
 
+  do concurrent (i=1:10);enddo
+  do,concurrent (i=1:10);arr(i)=i;enddo
+
   print *, arr
-end program basic_do_concurrent
\ No newline at end of file
+end program basic_do_concurrent