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

icc 17.0.0 miscompiles valid C code (compiled code hangs) at -O1 and above on x86_64-linux-gnu

Zhendong_Su
Beginner
437 Views

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
$ 
$ gcc-6.2 -O0 small.c; ./a.out
$ clang-3.8 -O0 small.c; ./a.out
$ 
$ cat small.c
struct
{
  int f:1;
} volatile a;

int b = 1, c;

int main ()
{
  a.f = 1;
  while (!(b && a.f < c))
    ; 
  return 0; 
}
$ 

 

0 Kudos
1 Reply
Yuan_C_Intel
Employee
437 Views

Hi, Zhendong

Thank you for raising the issue.

I have reproduced your issue and entered it in our problem tracking system. We will try to resolve this issue as soon as we can. However, please be advised that this issue may have to be targeted to for the next major release. I will let you know when I have an update on this issue.

Thanks.

0 Kudos
Reply