https://gcc.gnu.org/g:f72519081e4c98bee6112c09e96c324ba80d0d53
commit f72519081e4c98bee6112c09e96c324ba80d0d53 Author: Tobias Burnus <tbur...@baylibre.com> Date: Thu Jan 23 22:28:44 2025 +0100 fortran/openmp.cc: Fix var init and locus use to avoid uninit values [PR fortran/116661] gcc/fortran/ChangeLog: PR fortran/116661 * openmp.cc (gfc_match_omp_prefer_type): NULL init a gfc_expr variable and use right locus in gfc_error. (cherry picked from commit 4e9265a474def98cb6cdb59c15fbcb7630ba330e) Diff: --- gcc/fortran/ChangeLog.omp | 9 +++++++++ gcc/fortran/openmp.cc | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp index 051b90a6a7d7..0d353d55957d 100644 --- a/gcc/fortran/ChangeLog.omp +++ b/gcc/fortran/ChangeLog.omp @@ -1,3 +1,12 @@ +2025-01-23 Tobias Burnus <tbur...@baylibre.com> + + Backported from master: + 2024-09-11 Tobias Burnus <tbur...@baylibre.com> + + PR fortran/116661 + * openmp.cc (gfc_match_omp_prefer_type): NULL init a gfc_expr + variable and use right locus in gfc_error. + 2025-01-23 Tobias Burnus <tbur...@baylibre.com> Backported from master: diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc index beaf10123894..89d64c36df3a 100644 --- a/gcc/fortran/openmp.cc +++ b/gcc/fortran/openmp.cc @@ -1943,6 +1943,7 @@ gfc_match_omp_prefer_type (char **pref_str, int *pref_str_len, int **pref_int_ar } fr_found = true; gfc_symbol *sym = NULL; + e = NULL; locus loc = gfc_current_locus; if (gfc_match_symbol (&sym, 0) != MATCH_YES || gfc_match (" _") == MATCH_YES) @@ -1964,7 +1965,7 @@ gfc_match_omp_prefer_type (char **pref_str, int *pref_str_len, int **pref_int_ar { gfc_error ("Expected constant integer identifier or " "non-empty default-kind character literal at %L", - &e->where); + &loc); gfc_free_expr (e); return MATCH_ERROR; }