[cfe-dev] Using both OpenCL and GCC vectors

Yung, Douglas via cfe-dev cfe-dev at lists.llvm.org
Mon Feb 8 18:37:02 PST 2016


Hi,

> If the types are different, but mangle in the same way, the correct
> behaviour here is to either:
> 
> 1. Mangle them differently, but that will break ABI compatibility and
> you'll end up with template implementation explosion of identical
> functions.
> 
> 2. Error out with re-defined symbol, but in a way to identify the
> source of the error. (Clang errs here). The user then changes the
> source to use the same compiler type.

What worries us here is that code which previously compiled successfully (although likely incorrectly) on 3.7 is now failing to compile with 3.8. The compiler currently implements the second behavior your described, but gives a slightly unhelpful error message that could be improved (PR25343).

I feel that the first behavior is better in the long run as these are two unique types. However, if either does decide to change, it will not be a quick process, and this issue exists today in a compiler that is about to be released. Because of that, I think it would be helpful to users if we added a note in the clang vector documentation that these two vectors cannot be used together in some situations due to this issue. What do you think?

Douglas Yung


More information about the cfe-dev mailing list