https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122306
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Solution:
* Split the checking part from the parsing part and move it to
the resolving part.
* In the resolving part - at least for metadirectives -
we probably want to directly create a 'tree' from the
selector (→ gfc_trans_omp_set_selector)
as this permits calling omp_check_context_selector
+ omp_context_selector_matches
The latter than permits to remove never-matching cases
like 'implementation({vendor("not-gnu")}',
'user={condition(complex-but-constant-eval-expr)}'
etc. - also to handle PR120180 properly.
To handle the last bullet point and the remark,
some tweaking might be required to remove
unreachable branches before fully evaluating the
contained body - instead of the simple tree walk
during resolution.