Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

icc 17.0.1 miscompiles valid C code (compiled code SIGFPE) at -Os and above on x86_64-linux-gnu

Zhendong_Su
Beginner
358 Views

Compiler version and platform: 

Intel(R) C Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.1.132 Build 20161005 

$ icc -O1 small.c; ./a.out
$ 
$ icc -Os small.c
$ ./a.out
Floating point exception (core dumped)
$ 
$ cat small.c
struct
{
  int f0:2;
  int f1:2;
} f = {0, 1};

int a = 3, b, d;
volatile unsigned int c;
char e, g;

int main ()
{
  for (; a; a--)
    {
      char h = ~1 ^ d;
      d = b >> 0 / h;
      int j; 
      if (!(e || f.f0 > c))
        j = b;
      f.f0 = g = b = j;
    }
  return 0; 
}
$ 

 

0 Kudos
0 Replies
Reply