Skip to content

[Clang] Missing AddressSpaceCast on CXX PointerToMember global. #123241

Open
@jhuber6

Description

@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.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions