https://bugs.llvm.org/show_bug.cgi?id=43255

            Bug ID: 43255
           Summary: backend error because clang doesn't type check address
                    space qualifiers during casting
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: d...@znu.io
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk

The following code will crash in the backend because clang isn't type checking
address space qualifiers during casting. To fix the code, uncomment the line
below.

struct Cache {
        long buffer[100];
};

class Thread {
public:
        Thread *self;
        char buffer[100*8];
        Thread() : self(this) {}
};

__attribute__((address_space(257)))
Thread *const _foo = nullptr;


long getIndex(unsigned long index) {
        return ((
//__attribute__((address_space(257)))
                                Cache*)_foo->buffer)->buffer[index];
}

Sema should catch this mismatch and diagnose.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to