Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Zhendong_Su
Beginner
113 Views

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

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