#1403 intrin.h and emmintrin.h conflicting SSE declaration

closed-invalid
nobody
MinGW (57)
2014-10-22
2010-03-03
Eamon
No

Both emmintrin.h and intrin.h include SSE intrinsics such as _mm_add_sd.

In intrin.h:
extern "C"{
//[...]
__MACHINEX86X(__m128d _mm_add_sd(__m128d,__m128d))
//[...]
}

In emmintrin.h:
extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_add_sd (__m128d __A, __m128d __B)
{
return (__m128d)__builtin_ia32_addsd ((__v2df)__A, (__v2df)__B);
}

This causes errors such as...
c:\gcc\equation443\bin\../lib/gcc/x86_64-pc-mingw32/4.4.3/include/emmintrin.h:234: error: previous declaration of 'double __vector__ _mm_add_sd(double __vector__, double __vector__)' with 'C++' linkage
c:\gcc\equation443\bin\../lib/gcc/x86_64-pc-mingw32/4.4.3/../../../../x86_64-pc-mingw32/include/intrin.h:599: error: conflicts with new declaration with 'C' linkage

The above compile error is the first error in the following sample:
Non-compiling sample (also attached):
#include <emmintrin.h>
#include <windows.h>
int main(int , char* []) { return 0; }

Working Sample (possible workaround):
#include <windows.h>
#include <emmintrin.h>
int main(int , char* []) { return 0; }

Environment: gcc -v
Built by Equation Solution <http://www.Equation.com>.
Using built-in specs.
Target: x86_64-pc-mingw32
Configured with: ../gcc-4.4.3-mingw/configure --host=x86_64-pc-mingw32 --build=x86_64-unknown-linux-gnu --target=x86_64-pc-mingw32 --prefix=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/gcc/4.4.3 --with-gmp=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/gmp --with-mpfr=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/mpfr --with-mpc=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/mpc --with-sysroot=/home/gfortran/gcc-home/binary/mingw32/cross/x86_64/gcc/4.4.3 --with-gcc --with-gnu-ld --with-gnu-as --disable-shared --disable-nls --disable-tls --enable-libgomp --enable-languages=c,fortran,c++ --enable-threads=win32 --disable-win32-registry
Thread model: win32
gcc version 4.4.3 (GCC)

...which is one of the mingw binaries on http://www.equation.com/servlet/equation.cmd?call=fortran

Discussion

  • Eamon
    Eamon
    2010-03-03

    non-compiling sample.

     
    Attachments
  • Eamon
    Eamon
    2010-03-03

    A few more details:

    - Including <intrin.h> and <emmintrin.h> directly (and not via windows or more specificically windef.h) always triggers the problem

    - My system is an english Win7 Pro x64 and has VS.NET 2010RC installed; in case it matters.

     
  • Eamon
    Eamon
    2010-08-26

    Is this bug tracker actually alive? This bug makes using http://eigen.tuxfamily.org/ tricky.

     
  • Earnie Boyd
    Earnie Boyd
    2011-12-13

    • status: open --> closed-invalid
     
  • Earnie Boyd
    Earnie Boyd
    2011-12-13

    You've included code from the SDK causing a license conflict. Not to mention the fact that intrin.h contains inline functions intrinsic only to MSVC and not to gcc.