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

icc 17.0.0 miscompiles valid C code (compiled code hangs) at -O1 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.0.098 Build 20160721

$ icc -O0 small.c; ./a.out
$ 
$ icc -O1 small.c
$ timeout -s 9 10 ./a.out
Killed
$ 
$ cat small.c
volatile int b = 1;
static int c;

short fn1 ()
{
  if (1)
    return b;
  return c;
}

int fn2 ()
{
  while (1)
    if (fn1 ())
      return 2;
}

int main ()
{
  fn2 ();
  return 0; 
}
$ 

 

0 Kudos
2 Replies
Igor_V_Intel
Employee
90 Views

Reproduced with 17.0 and escalated (DPD200415574). Thanks.

Zhendong_Su
Beginner
90 Views

Thanks, Igor. 

Reply