From 78c787bbe593b24d73dbcfe59b8f6103be1e798f Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Sat, 6 Dec 2025 08:05:41 +0000 Subject: Fortran: [PDT] Failure with local allocatable PDT array [PR122693] 2025-12-06 Paul Thomas gcc/fortran PR fortran/122693 * array.cc (gfc_match_array_constructor): Stash and restore gfc_current_ns after the call to 'gfc_match_type_spec'. gcc/testsuite PR fortran/122693 * gfortran.dg/pdt_75.f03: New test. --- gcc/fortran/array.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/fortran/array.cc') diff --git a/gcc/fortran/array.cc b/gcc/fortran/array.cc index 359d743..471f0cb 100644 --- a/gcc/fortran/array.cc +++ b/gcc/fortran/array.cc @@ -1344,6 +1344,7 @@ gfc_match_array_constructor (gfc_expr **result) match m; const char *end_delim; bool seen_ts; + gfc_namespace *old_ns = gfc_current_ns; head = NULL; seen_ts = false; @@ -1368,6 +1369,8 @@ gfc_match_array_constructor (gfc_expr **result) /* Try to match an optional "type-spec ::" */ gfc_clear_ts (&ts); m = gfc_match_type_spec (&ts); + gfc_current_ns = old_ns; + if (m == MATCH_YES) { seen_ts = (gfc_match (" ::") == MATCH_YES); -- cgit v1.1