Hello,
I get a crash when trying to compile a C/C++ program with icc
icc -O3 fail.cc
": internal error: ** segmentation violation signal raised **
Access violation or stack overflow. Please contact Support.
compilation aborted for fail.cc (code 4)
Version:
icc (ICC) 14.0.2 20140120
Copyright (C) 1985-2014 Intel Corporation. All rights reserved.
System: CentOS 6.5 Linux, 64 bit (kernel version: 2.6.32-431.5.1.el6.x86_64)
Attached the fail.cc file. The problem only occurs when both _may_i_use_cpu_feature and __cpuid are used together.
#include <stdlib.h>
#include <stdio.h>
#include <immintrin.h>
bool is_cpuid_ecx_bit_set(int eax, int bitidx)
{
//int ecx = 0, edx = 0, ebx = 0;
//__asm__ ("cpuid"
//:"=b" (ebx),
//"=c" (ecx),
//"=d" (edx)
//:"a" (eax)
//);
//return (((ecx >> bitidx)&1) == 1);
int cpuinfo[4];
int infotype = eax;
__cpuid(cpuinfo, infotype);
return (((cpuinfo[2] >> bitidx) & 1) == 1);
}
main()
{
int eax = 1;
if(_may_i_use_cpu_feature(_FEATURE_AVX) > 0)
//if(false)
printf("true\n");
else
if(is_cpuid_ecx_bit_set(eax, 28))
printf("core true\n");
else
printf("core false\n");
return 0;
}