[cxx-abi-dev] Mangling for OpenCL and GCC vectors

Yung, Douglas douglas_yung at playstation.sony.com
Thu Feb 4 01:06:23 UTC 2016


Hi,

Recently in our testing we encountered an abi issue that we were hoping to get clarified. Specifically, this concerns the mangling of OpenCL and GCC vectors which seems to be identical when comparing the results of GCC vectors compiled by GCC5 and OpenCL vectors when mangled according to the SPIR 1.2 spec.

First a little background. Clang supports using both OpenCL and GCC vectors in a program. When used, clang permits certain operations to be performed on each as detailed in the table found at http://clang.llvm.org/docs/LanguageExtensions.html#vectors-and-extended-vectors. From the differences there, it seems the compiler treats the types as unique which makes sense as they support different operations.

The problem we found arises when you try to use both in the same program. Consider the following example:

template <typename alpha>
static void foo() {}

void bar() {
  foo<float __attribute__((__vector_size__(16)))>();
  foo<float __attribute__((ext_vector_type(4)))>();
}

In this example, the compiler creates two copies of the function foo, once using a GCC vector, and once using an OpenCL vector. These functions mangle to the same string " _ZL3fooIDv4_fEvv" which the compiler detects and issues an error. Is the fact that the two vectors mangle identically by design or just a coincidence? If it is by coincidence, should the compiler merge the two type definitions when it encounters them, or was there some other intention here that we are unaware of?

Thoughts?

Douglas Yung
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/cxx-abi-dev/attachments/20160204/b2cde339/attachment-0001.html>


More information about the cxx-abi-dev mailing list