In the intrin.h header there is an include of x86intrin.h whenever __GNUC__ is defined and we are compiling for x86 or x64.
If you look at the x86intrin.h header file you will see it includes header files for all intrinsics regardless of whether the CPU feature exists or not. This is true for gcc-4.9 on up. Yet for gcc below 4.9 the x86intrin.h only included an intrinsic header file if that CPU feature actually existed. I realize that this change of the x86intrin.h header from gcc-4.8 to gcc-4.9 and up may have been mandated by a change in gcc itself and not something done by the mingw-64 developers. In gcc 4.9 and up this leads to multiple typedefs using the same name for __m64, __m128, __m128d, and __m128i whenever the __MMX__ CPU feature does not exist and __MINGW_FORCE_SYS_INTRINS is not defined. Normally this is not a problem since __MINGW_FORCE_SYS_INTRINS is defined whenever the gcc version is 4.9 and up, and after all the header file change is precisely for gcc-4.9 and up implementations. But what happens if the intrin.h header file for gcc-4.9 and up is being used by a compiler implementation in which the gcc version is set below 4.9. Now __MINGW_FORCE_SYS_INTRINS is not defined and we do have multiple typedefs using the same __m64, __m128, __m128d, and __m128i names, which is of course a C++ error. Unfortunately such a compiler implementation does exist, namely 'clang' which uses the gcc headers and RTL. A recent update to the clang source now allows it to work with mingw-64 on Windows and automatically pick up whatever mingw-64 implementation is on the PATH. But clang still sets a value to its gcc version below that of 4.9. The workaround for this is obviously to define __MINGW_FORCE_SYS_INTRINS for such a compiler implementation, which now avoids the multiple same name typedef problem. I can attest that the workaround does work when using clang. But wouldn't it be better if the workaround were unnecessary. I think this can be done in the intrin.h header file by merely using the check which allowed the x86intrin.h to be originally included in the first place. So instead of: #ifndef __MINGW_FORCE_SYS_INTRINS #ifndef __MMX__ etc. as the first check for the MMX substitution typedefs in intrin.h it could be: #if !defined(__MINGW_FORCE_SYS_INTRINS) && !(defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) #ifndef __MMX__ etc. I have tested this change out and it works fine with the mingw-64 gcc-5.1 implementation. ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
