[PATCH] D73360: [OpenCL] Restrict address space conversions in nested pointers
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 24 08:15:08 PST 2020
Anastasia created this revision.
Anastasia added reviewers: rjmccall, jeroen.dobbelaere, bevinh.
Herald added subscribers: ebevhan, yaxunl.
This patch is fixing the issue reported in:
http://lists.llvm.org/pipermail/cfe-dev/2020-January/064273.html
and in the bug:
https://bugs.llvm.org/show_bug.cgi?id=39674
Since address space conversion changes pointer representation it is not legal to do it for the nested pointers even with compatible address spaces. Because the address space conversion in the nested levels can't be generated. The behavior implemented by this patch is as follows:
- Reject any implicit conversions of nested pointers with address spaces.
- Reject address space of nested pointers conversions in safe casts e.g. `const_cast` or `static_cast.`
- Allow conversion in low level C-style or `reinterpret_cast` but with a warning (this aligns with OpenCL C behavior).
https://reviews.llvm.org/D73360
Files:
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaCast.cpp
clang/lib/Sema/SemaOverload.cpp
clang/test/Misc/warning-flags.c
clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
clang/test/SemaOpenCL/address-spaces.cl
clang/test/SemaOpenCLCXX/address-space-castoperators.cl
clang/test/SemaOpenCLCXX/address-space-deduction.cl
clang/test/SemaOpenCLCXX/address-space-references.cl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73360.240205.patch
Type: text/x-patch
Size: 11846 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200124/e797a9f1/attachment.bin>
More information about the cfe-commits
mailing list