On Sat, Oct 16, 2021 at 02:44:12AM +0800, Chung-Lin Tang wrote: > The patch currently does not allow strictly-structured BLOCK for > sections/parallel sections, > since I was referencing the 5.1 spec while writing it, although that is > trivially fixable. > (was sensing a bit odd why those two constructs had to be specially treated > in 5.1 anyways) > > The bigger issue is that under the current way the patch is written, the > statements inside > a [parallel] sections construct are parsed automatically by > parse_executable(), so to enforce > the specified meaning of "structured-block-sequence" (i.e. BLOCK or non-BLOCK > starting sequence of stmts) > will probably be more a bit harder to implement: > > !$omp sections > block > !$omp section > block > x=0 > end block > x=1 !! This is allowed now, though should be wrong spec-wise > !$omp section > x=2 > end block > > Currently "$!omp section" acts essentially as a top-level separator within a > sections-construct, > rather than a structured directive. Though I would kind of argue this is > actually better to use for the > user (why prohibit what looks like very apparent meaning of the program?) > > So Jakub, my question for this is, is this current state okay? Or must we > implement the spec pedantically?
I'd certainly not implement 5.1 pedantically when we know we'd change one way for 5.0 -> 5.1 and change it back again for 5.1 -> 5.2. An example of that is !$omp sections !$omp section block end block x = 1 !$end omp sections This is valid in 5.0 and will be valid again in 5.2 with the same meaning, so let's just use the 5.0/5.2 wording here. Ditto the !$omp end ambiguity Tobias raised etc. Whether to add support for the 5.2 behavior when one sees !$omp {,parallel }sections block or not is more tough question, I bet the answer should be what is easier to implement right now (i.e. don't spend too much effort on hard 5.1 implementation if 5.2 would be easier, as eventually we'd need to do the 5.2 implementation afterwards anyway). So, for block right after sections either we implement the 5.2 wording right away and therefore look for !$omp section only within that block and not outside of it, or we for the 1st section with omitted !$omp section before it only implement the 5.1 pedantic behavior, i.e. if it starts with a block, don't look for !$omp section in the block, but require either !$omp section or !$omp end sections right after the corresponding end block. Does this answer all questions? Jakub