Compiling the following causes clang to crash
char *cmp(__attribute__((address_space(1))) char *x, __attribute__((address_space(2))) char *y) { return x < y ? x : y; }
with the message: "wrong cast for pointers in different address spaces(must be an address space cast)!"
This is because during IR emission, the source and dest type for a bitcast should not have differing address spaces.
This fix prints an error since the code shouldn't compile in the first place.
Aren't these the errors you actually want?