[PATCH] D77821: [Flang][OpenMP] Avoid abort when collapse clause value is negative

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 20:08:25 PDT 2020


jdoerfert added a comment.

In D77821#1973046 <https://reviews.llvm.org/D77821#1973046>, @ichoyjx wrote:

> In D77821#1972684 <https://reviews.llvm.org/D77821#1972684>, @jdoerfert wrote:
>
> > Why is this not caught by the parser? I mean, this seems a lot of code to accommodate negative values and some conditions to not trip over them even though they are never allowed/useful.
>
>
> The argument is only an Expr to the parser. To check whether it's an integer or constant, we need to do that in Semantics.


As far as I can tell, the collapse argument is a `scalarIntConstantExpr` to the parser. So conceptually one could make it a `scalarPositiveIntConstantExpr` and issue an error early.
One should consider this to avoid implicit dependences expressed as `TODO`s that require checks in places that may be visited before the collapse is verified.

  ​// TODO: This assumes that the do-loops association for collapse/ordered
  //       clause has been performed (the number of nested do-loops >= n).
  void OmpAttributeVisitor::PrivatizeAssociatedLoopIndex(


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77821/new/

https://reviews.llvm.org/D77821





More information about the llvm-commits mailing list