]> 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>
Fri, 9 May 2025 19:57:03 +0000 (21:57 +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.

(cherry picked from commit 6ce73ad4370c143a7d1e6a13b1d353db5884213f)

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

index ec9e5873204a654bb60b6cb4de45499dfbdb6c05..0f6b8e95ad72c6c132bc093d6b7aafc6d0f023dd 100644 (file)
@@ -2738,7 +2738,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)
            {
@@ -2987,6 +2987,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