[OG13,committed] OpenMP/Fortran: Fix parsing of metadirectives with BLOCK

Message ID 56e022f9-06c8-4656-bcdf-b052fd0cae04@codesourcery.com
State Unresolved
Headers
Series [OG13,committed] OpenMP/Fortran: Fix parsing of metadirectives with BLOCK |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Tobias Burnus Oct. 31, 2023, 1:18 p.m. UTC
  This is an OG13-only patch as metadirectives are not yet on mainline.
I think it is a side effect of the backported my mainline patch that
fixed strictly-nested blocks that was backported to OG13 on Oct 8, 2023
in OG13 commit 36e5f02e64bd4b5b1eaf89993a63c56b01cd4e7c.

Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
  

Patch

commit 46feedaddf8e4d82b7a24557c7bb4c8c3ee287a0
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Tue Oct 31 12:03:44 2023 +0100

    OpenMP/Fortran: Fix parsing of metadirectives with BLOCK
    
    Probably a fallout of the backport of r14-4471-g6a8edd50a149f1
      Fortran/OpenMP: Fix handling of strictly structured blocks
    This showed up as parsing error/fail with
     libgomp.fortran/metadirective-1.f90
     libgomp.fortran/metadirective-6.f90
    
    gcc/fortran/
    
            * decl.cc (gfc_match_end): Handle unnamed END BLOCK with
            metadirectives.
---
 gcc/fortran/ChangeLog.omp | 5 +++++
 gcc/fortran/decl.cc       | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp
index 6b30302428f..e20a88b8740 100644
--- a/gcc/fortran/ChangeLog.omp
+++ b/gcc/fortran/ChangeLog.omp
@@ -1,3 +1,8 @@ 
+2023-10-31  Tobias Burnus  <tobias@codesourcery.com>
+
+	* decl.cc (gfc_match_end): Handle unnamed END BLOCK with
+	metadirectives.
+
 2023-10-30  Tobias Burnus  <tobias@codesourcery.com>
 
 	* trans-openmp.cc (gfc_trans_omp_clauses): Avoid gfc_evaluate_now
diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc
index 783c39438e8..4c04e64d37c 100644
--- a/gcc/fortran/decl.cc
+++ b/gcc/fortran/decl.cc
@@ -8409,6 +8409,9 @@  gfc_match_end (gfc_statement *st)
 		&& state_data->sym->abr_modproc_decl;
 	}
 	while (state == COMP_OMP_METADIRECTIVE);
+
+	if (startswith (block_name, "block@"))
+	  block_name = NULL;
       }
       break;
     default: