icc crash

icc crash

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;
}

 

 

 

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Best Reply

 

Thank you for reporting this bug, I have entered it in our internal bug tracking database (number

DPD200254737).

The crash is occurring in some compiler code that deals with restructuring of blocks so I think a workaround is to change the code so that the call to _may_i_use_cpu_feature is not inside a block, i.e.:

 

Change this:

  if(_may_i_use_cpu_feature(_FEATURE_AVX) > 0) {
 

to:

  bool b = _may_i_use_cpu_feature(_FEATURE_AVX);
  if (b > 0) {
 

Sorry for the inconvenience.

Judy

 

 

Thanks - that worked.

Leave a Comment

Please sign in to add a comment. Not a member? Join today