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.
This error is very similar to the one in my first comment, conditional operator with the second and third operands of type ('__attribute__((address_space(1))) char *' and '__attribute__((address_space(2))) char *') which are pointers to non-overlapping address spaces. It would normally be emitted at 6472, but won't be since OpenCL isn't enabled.