Vector Class Discussion

 
thread Apple Clang version check unreliable - Cosmin Deaconu - 2017-05-09
last replythread Apple Clang version check unreliable - Agner - 2017-05-09
last replythread Apple Clang version check unreliable - Cosmin Deaconu - 2017-05-09
last reply Apple Clang version check unreliable - Agner - 2017-05-10
 
Apple Clang version check unreliable
Author:  Date: 2017-05-09 12:15
The most recent update to the vector class added a version check for Apple-provided clang compilers, which seems to cause issues for some users using OS X. Removing the version check (and just using the preprocessor workaround for clang's aliasing bugs) fixes it. The clang version reported by their compilers is 8000042. My guess is that the version reported by Apple-provided clang is pure fantasy and should not be trusted. I don't have access to an OS X machine so I cannot provide too many more details.

For now, as a workaround, we are now using a patched in-tree version with the clang version check reverted.

   
Apple Clang version check unreliable
Author: Agner Date: 2017-05-09 13:32
Cosmin Deaconu wrote:
The most recent update to the vector class added a version check for Apple-provided clang compilers, which seems to cause issues for some users using OS X. Removing the version check (and just using the preprocessor workaround for clang's aliasing bugs) fixes it. The clang version reported by their compilers is 8000042.
Yes, the Clang version reported by Apple Clang has no relationship to the version on other platforms, and they refuse to fix it. We have to rely on the "Apple build version". It would be useful if you could get the value of "Apple build version", which is in the macro named __apple_build_version__

If there are any Mac users out there who can contribute more to find out this problem then please let us know. The problem is that previous versions of Clang do not distinguish between the vector types __m128, __m128i and __m128f, but apparently Apple Clang version 6.2.something does. They don't respond to bug reports about this.

   
Apple Clang version check unreliable
Author:  Date: 2017-05-09 14:56
8000042 is the output of printf("%d\n", __apple_build_version__) , which is supposed to be several years newer than Apple Clang 6.02, but fails with the aliasing-related error:

vectorf128.h:237:22: error: ambiguous conversion for functional-style cast from 'const Vec4fb' to 'Vec4ib'
return Vec4fb( ! Vec4ib(a));

It's possible that it worked in 6.02 but then was broken again in some subsequent version. Apple's clang builds are available from https://opensource.apple.com/, so it might be possible to test this on a non OS-X system, although I haven't checked to see if they'll build on my system or not. Hopefully some enterprising person has time to figure out which versions have broken aliasing.

   
Apple Clang version check unreliable
Author: Agner Date: 2017-05-10 02:28
I have reverted the change now, until we have further clarification. Thanks for the report.