On Wed, Jun 24, 2020 at 05:47:06PM +0100, Kwok Cheung Yeung wrote: > There appears to be a bug in the handling of the 'if' clause (without a > directive name modifier) for combined OpenMP constructs in the Fortran > front-end: > > static void > gfc_split_omp_clauses (gfc_code *code, > gfc_omp_clauses clausesa[GFC_OMP_SPLIT_NUM]) > { > ... > if (code->ext.omp_clauses != NULL) > { > if (mask & GFC_OMP_MASK_TARGET) > { > /* And this is copied to all. */ > clausesa[GFC_OMP_SPLIT_PARALLEL].if_expr > = code->ext.omp_clauses->if_expr; > }
Yeah, looks like a pasto. > Currently, if 'target' is in the combined contruct, then the 'if' is applied > to the 'parallel' construct, but there are combined constructs with 'target' > but not 'parallel' (e.g. target teams distribute), which result in the 'if' > not getting applied at all. This is also redundant, as the unmodified if is > always applied to the 'parallel' construct if there is one. > > The patch changes the behaviour to match what the common C/C++ FE does, > which is to apply the 'if' to every applicable sub-construct in the combined > construct. I have included a testcase to check that the if clauses have been > applied correctly by the time it gets to the ME. I have also found a case > that results in an ICE (using 'target parallel' with an 'if' clause) - I > have commented out this out for now and filed it as PR 95869. > > I have tested for regressions in the gfortran and libgomp testsuites. Okay > for master/OG10? Ok, thanks. Though, while you are at it, if you'd like to also add the related, but still missing support for if (simd: ...), or if (cancel: ...) that C/C++ already do support, it would be greatly appreciated. Jakub