[PATCH] D50278: [Sema] Fix for crash on conditional operation with address_space pointer

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 6 15:51:51 PDT 2018


rjmccall added inline comments.


================
Comment at: lib/Sema/SemaExpr.cpp:6522
+    bool HasDifferingLAddrSpace = LAddrSpace != ResultAddrSpace;
+    bool HasDifferingRAddrSpace = RAddrSpace != ResultAddrSpace;
+
----------------
I was going to tell you to use the predicate `Qualifiers::isAddressSpaceSupersetOf` here, but then I was looking at the uses of that, and I think the real fix is to just go into the implementation of `checkConditionalPointerCompatibility` and make the compatibility logic not OpenCL-specific.  The fast-path should just be whether the address spaces are different.

And it looks like this function has a bug where it always uses `LangAS::Default` outside of OpenCL even if the pointers are in the same address space.


Repository:
  rC Clang

https://reviews.llvm.org/D50278





More information about the cfe-commits mailing list