From af51fe9593ec0e9373f8a453bab2129a48193a44 Mon Sep 17 00:00:00 2001 From: Paul-Antoine Arras Date: Fri, 31 Jan 2025 11:41:47 +0100 Subject: OpenMP/Fortran: Add missing pop_state in parse_omp_dispatch [PR118714] When the ST_NONE case is taken, the function returns immediately. Not calling pop_state causes a dangling pointer. PR fortran/118714 gcc/fortran/ChangeLog: * parse.cc (parse_omp_dispatch): Add missing pop_state. --- gcc/fortran/parse.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/fortran/parse.cc b/gcc/fortran/parse.cc index 00cd23d..5094d9d 100644 --- a/gcc/fortran/parse.cc +++ b/gcc/fortran/parse.cc @@ -6375,7 +6375,10 @@ parse_omp_dispatch (void) st = next_statement (); if (st == ST_NONE) - return st; + { + pop_state (); + return st; + } if (st == ST_CALL || st == ST_ASSIGNMENT) accept_statement (st); else -- cgit v1.1