[llvm-bugs] [Bug 43255] New: backend error because clang doesn't type check address space qualifiers during casting

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 9 06:07:35 PDT 2019


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: unassignedclangbugs at nondot.org
          Reporter: dave at znu.io
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190909/0a2221b2/attachment-0001.html>


More information about the llvm-bugs mailing list