[Mlir-commits] [mlir] [mlir][OpenMP] allow cancellation to not be directly nested (PR #134084)

Kiran Chandramohan llvmlistbot at llvm.org
Wed Apr 2 09:02:39 PDT 2025


kiranchandramohan wrote:

> > subroutine one
> > !$omp parallel do
> > do i = 1, N
> > if (cond) then
> > call two()
> > endif
> > enddo
> > end subroutine
> > subroutine two
> > !$omp cancel do
> > end subroutine
> 
> My reading of the standard seems to allow this, but classic flang and gfortran both refuse to compile it, along with clang and gcc (after rewriting in c++). Clang, gfortran and gcc all describe the cancel construct as "orphaned".

If it is specified to require a closely nested construct then the above code is invalid. It is also invalid to have other OpenMP constructs in between. Will the relaxation in check miss this?
If it is specified to require a closely nested region then the above code is valid.

https://github.com/llvm/llvm-project/pull/134084


More information about the Mlir-commits mailing list