]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
OpenMP/Fortran: Skip context selectors that have OMP_TRAIT_INVALID [PR122439]
authorPaul-Antoine Arras <parras@baylibre.com>
Mon, 27 Oct 2025 14:25:17 +0000 (15:25 +0100)
committerPaul-Antoine Arras <parras@baylibre.com>
Tue, 28 Oct 2025 09:57:34 +0000 (10:57 +0100)
This fixes a fallout of r16-4540-g80af807e52e4f4 that caused undefined
behaviour.

PR fortran/122439

gcc/fortran/ChangeLog:

* openmp.cc (gfc_resolve_omp_context_selector): Skip selectors that have
OMP_TRAIT_INVALID.

(cherry picked from commit b8a8bb30d950b49beeac17e3495ca78d67278cd7)

gcc/fortran/openmp.cc

index 7a915adbb9da5e9fe5d7a77494b5a1e056e1e43a..c603d3784fd027c23f18295eda58e6cd39bcb67b 100644 (file)
@@ -12787,6 +12787,8 @@ gfc_resolve_omp_context_selector (gfc_omp_set_selector *oss,
              }
          }
 
+       if (os->code == OMP_TRAIT_INVALID)
+         break;
        enum omp_tp_type property_kind = omp_ts_map[os->code].tp_type;
        gfc_omp_trait_property *otp = os->properties;