[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 27 13:04:40 PST 2020


ABataev added inline comments.


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:15710
+    // know the other subtree is just an offset)
+    assert(BO->getType()->isPointerType() &&
+           "Expect the binary operator be pointer type");
----------------
cchen wrote:
> cchen wrote:
> > ABataev wrote:
> > > Not sure this should be an assert. What if you have something like `*((a+b) + c)` and `a+b` is not pointer arithmetic?
> > Good point, I'll fix it. Thanks
> Well, for this case, the type of binop expr `*((a+b) + c)` is `int *`, and the type of LHS is `int`, while the type of RHS is `int *`, therefore, expr `(a+b)` is not going to be visited. I'm using assert here since before the `checkMapClauseExpressionBase` be called, we have already check for whether the expression is lvalue. Maybe I'll just error out if binop here is not a pointer type instead of `assert`?
Yes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75077





More information about the cfe-commits mailing list