Issue 123241
Summary [Clang] Missing AddressSpaceCast on CXX PointerToMember global.
Labels clang
Assignees
Reporter jhuber6
    The following code crashed when run on an NVIDIA or AMD GPU due to a missing address space cast https://godbolt.org/z/3vx6avrT6.
```c++
struct S {
 int x;
};

[[clang::loader_uninitialized]] S [[clang::address_space(3)]] s;

int &lookup(int S::*in) {
    return s.*in;
}
```

The generated IR accesses the global `s` but does not emit an address space cast  to the generic address space. We do not emit an address space cast, because it is missing from the AST like should normally be applied prior to the `ReturnStmt`.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to