Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Matt_S_2
Beginner
138 Views

error: class "__m128" has no suitable assignment operator

This code 

#include <xmmintrin.h>

 

volatile __m128 a, b;

 

void test(void)

{

     a = b;

}

 

produces this error

$ /opt/intel/composerxe/bin/icpc -c test.cc

test.cc(7): error: class "__m128" has no suitable assignment operator

       a = b;

           ^

 

compilation aborted for test.cc (code 2)

 

when compiled with icpc.  There is no error if the variables are not volatile.  There is no error with icc or gcc or g++.

Any suggestion on how to compile it with icpc?

 

 

0 Kudos
4 Replies
138 Views

I've reproduced the issue and the issue is caused by wrong processing in C++ mode. ICC is the C compiler and ICPC is the C++ compiler, if you name your file as ".cpp", even icc will fail (as icc will use icpc for .cpp files).

Is there any reason you must use icpc to compile? You may force icpc to build in C mode to avoid the bug...see below:

$ cat temp.c
#include <xmmintrin.h>
#ifndef OK
volatile
#endif
__m128 a, b;
void test(void) { a = b; }
$ gcc temp.c -c
$ g++ temp.c -c
$ g++ -x c++ temp.c -c
$ icc temp.c -c
$ icc -x c++ temp.c -c
temp.c(6): error: class "__m128" has no suitable assignment operator
  void test(void) { a = b; }
                        ^

compilation aborted for temp.c (code 2)
$ icpc temp.c -c
temp.c(6): error: class "__m128" has no suitable assignment operator
  void test(void) { a = b; }
                        ^

compilation aborted for temp.c (code 2)
$ icpc -x c temp.c -c
$ icpc temp.c -c -DOK
$

GNU compiler will build ok in both C and C++ mode, but our compiler will fail in C++ mode. So, the workaround is to use C mode (use .c as file extension with icc, or use -x c for icpc).

Thanks,

Shenghong

138 Views

FYI. I'll track the issue as DPD200367042 in our problem tracking system.

Thanks,

Shenghong

Matt_S_2
Beginner
138 Views

Thanks for the update.  Unfortunately, this is a simplified example from a large code base; compiling it in C mode is not an option.

138 Views

Hi Matt,

FYI. This issue is fixed in v16.0 beta Update 1 version.

$ source /opt/intel/compilers_and_libraries_2016.0.056/linux/bin/compilervars.sh intel64
$ icc -x c++ temp.c -c
$ cat temp.c
#include <xmmintrin.h>
#ifndef OK
volatile
#endif
__m128 a, b;
void test(void) { a = b; }
$

Thanks,

Shenghong

Reply