[LLVMbugs] [Bug 10865] New: Address-space casts cause LLVM assertion

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Sep 5 12:00:41 PDT 2011


           Summary: Address-space casts cause LLVM assertion
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: pcwalton at mimiga.net
                CC: llvmbugs at cs.uiuc.edu

This code causes an LLVM assertion ("Pointer must be a pointer to Val type"
during generation of a StoreInst):

    #define MY_ADDRESS_SPACE    __attribute__((address_space(512)))
    void MY_ADDRESS_SPACE *x = (void MY_ADDRESS_SPACE *)malloc(123);

But this works fine:

    #define MY_ADDRESS_SPACE    __attribute__((address_space(512)))
    void MY_ADDRESS_SPACE *x = (void MY_ADDRESS_SPACE *)(uintptr_t)malloc(123);

Looks like clang isn't generating a bitcast instruction where one is needed,
and the intermediate uintptr_t forces the bitcast generation.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list