[PATCH] D58708: [PR40778] Preserve addr space in Derived to Base cast
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 5 10:09:27 PST 2019
Anastasia added inline comments.
================
Comment at: lib/Sema/SemaExpr.cpp:2670
} else {
DestType = DestRecordType;
FromRecordType = FromType;
----------------
rjmccall wrote:
> This path (when the object is a gl-value) also needs an address-space qualifier, so you should probably add it above and then just add a pointer in the pointer case.
I updated this but I haven't really found any test case that would fail. I guess because casting non-pointer types in different address spaces works fine...
For example the IR is generated correctly with or without the fix.
```
1 struct S {
2 volatile int a;
3 };
4
5 __global S g;
6
7 void foo(){
8 g.a;
9 }
```
However, I still think it's indeed good to add the address space in both cases for consistency.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58708/new/
https://reviews.llvm.org/D58708
More information about the cfe-commits
mailing list