This patch fixes an issue with unintialized variables causing random ICE.
Committed as r15-3581-g4e9265a474def9
* * *
However, follow-up work is needed as there are multiple issues:
* The check whether something is a identifier (integer parameter) and
not just a constant expression did fail in some corner cases. → causes
now reliably a testsuite FAIL.
* Some checks are also not quite right
* After gfc_match_expr, a gobble whitespace is missing
* I missed that 'fr(…)' and 'attr(…)' accept a list of values*
* The latter requires a different internal representation.
I have a partial fix for this, but the last two items remove some more
work, hence, I defer this to the next patch.
Tobias
(*) It looks also as if there will be post-TR13 spec changes, but it is
not clear whether those just change the wording or more.
commit 4e9265a474def98cb6cdb59c15fbcb7630ba330e
Author: Tobias Burnus <tbur...@baylibre.com>
Date: Wed Sep 11 09:25:47 2024 +0200
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.
diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index c04d8b0f528..1145e2ff890 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -1860,6 +1860,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)
@@ -1881,7 +1882,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;
}