]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
fortran/openmp.cc: Fix var init and locus use to avoid uninit values [PR fortran...
authorTobias Burnus <tburnus@baylibre.com>
Wed, 11 Sep 2024 07:25:47 +0000 (09:25 +0200)
committerTobias Burnus <tburnus@baylibre.com>
Wed, 11 Sep 2024 07:25:47 +0000 (09:25 +0200)
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.

gcc/fortran/openmp.cc

index c04d8b0f52812fec53fdd6bc5ef7099a5f66fa73..1145e2ff8900366dd668ce64e3d2a3f0146fd72d 100644 (file)
@@ -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;
                  }