Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

"illegal instruction" problem

Ricky_Wang
Beginner
234 Views
Hi ,
I built a "hello world" c++ program using icpc in Linux, but it crashes with "illegal instruction" when running in a CentOS VM. If built with g++, it is OK.
see below the simple hello world source code and CPU information of the CentOS.
rickyswang@gmail.com
Thanks,
Ricky
//!--icpc -o alpha.icpc alpha.cpp
//!--g++ -o alpha.g++ alpha.cpp
//alpha.cpp source code
#include
int main()
{
char x[] = "hello world!\\n";
printf(x);
return 0;
}

and below is the cpu info of the CentOS:
processor : 0
vendor_id : AuthenticAMD
cpu family : 6
model : 10
model name : mobile AMD Athlon XP-M 2200+
stepping : 0
cpu MHz : 1666.740
cache size : 512 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 mmx fxsr sse syscall mp mmxext 3dnowext 3dnow up nonstop_tsc ts fid vid
bogomips : 3333.48
0 Kudos
1 Reply
Mark_S_Intel1
Employee
234 Views
The Intel compiler uses "-msse2" compiler option by default. More information can be found at http://software.intel.com/en-us/articles/performance-tools-for-software-developers-intel-compiler-op...

To run the resulting binary the processor has to support SSE2 instructions. Looks like the the CPU in your system only supports SSE not SSE2. Does the binary run when you compile with g++ using the "-msse2" option?

--mark
Reply