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.
---
gcc/fortran/openmp.cc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index 357e6a7f09d..f5db9a81ea6 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -12236,6 +12236,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;
--
2.51.0