https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118694
--- Comment #5 from sandra at gcc dot gnu.org --- Created attachment 61485 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61485&action=edit test case metadirective-1a.c with dynamic selector Hmmm, interesting. I temporarily #ifdef'ed out the code that generates the bogus error. Not only does the libgomp metadirective-1.c test seem to run correctly, this similar test case with a dynamic selector (that implicitly inserts code to test the condition between the #pragma omp target and #pragma omp teams) works too. Are we required to diagnose this as an error or is it allowable to permit this as an extension? Diagnosing it would be rough; in general it can't happen until late resolution, and as I found previously, the optimizers that run before then can rewrite the code in all sorts of ways that make it hard to map it back onto its original structure. I'm thinking doing the check for correct target(?)/metadirective(?)/teams nesting either in the front ends or during gimplification, when we still have it in tree structure as close as possible to what the user wrote, would be better than omp-low, when gimplification has already messed with it.