Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Address-space casts cause LLVM assertion #11079

Open Quuxplusone opened 13 years ago

Quuxplusone commented 13 years ago
Bugzilla Link PR10865
Status NEW
Importance P normal
Reported by Patrick Walton (:pcwalton) (pcwalton@mimiga.net)
Reported on 2011-09-05 14:00:41 -0700
Last modified on 2011-09-06 14:02:56 -0700
Version unspecified
Hardware PC Linux
CC efriedma@quicinc.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
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.
Quuxplusone commented 13 years ago

I can't reproduce this with clang trunk; can you build a trunk build and retest?

If the issue still reproduces with trunk, please provide a self-contained testcase.