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

icx error: wrong code (Execution Timeout) at `-O1 -fPIC` (or `-O1 -mcmodel=large`) since `x86-64 icx

Junwei_Zeng
Beginner
482 Views

Hi,

 

I compiled the following code with icx at `-O1 -fPIC` (or `-O1 -mcmodel=large`), and it produces the wrong code. The correct result should be that the program execution ends normally, but the execution of the error code times out.


I found this bug was introduced starting from icx-2022.2.0.

 

Compiler explorer: https://godbolt.org/z/3qrddj9K8

$ cat test.c
int printf(const char *, ...);
int d[6];
int g, i, m, n, o;
char h, k, l;
struct a {
  long b;
  char c;
  int e;
  char f;
};
void v() {
  g &= 5 ^ d[g ^ h];
  g &= 5 ^ d[g ^ h];
  g &= 5 ^ d[g ^ h];
  g &= 5 ^ d[g ^ h];
  g &= 5 ^ d[g ^ h];
  g &= 5 ^ d[g ^ h];
  g &= 5 ^ d[g ^ h];
  g &= 5 ^ d[g ^ h];
}
static short w() {
  v();
  v();
  v();
  v();
  v();
  v();
  v();
  v();
  v();
  v();
  v();
  v();
  return 0;
}
static int *x();
static unsigned char y();
static int z() {
  v();
  v();
  v();
  v();
  return 0;
}
static int *aa();
static long ab() {
  struct a a[5];
  v();
  v();
  v();
  for (int b = 0; b < 5; b++)
    for (int c = 0; c < 5; c++)
      for (int e = 0; e < 2; e++) {
        v();
        v();
        v();
        printf("%d\n", a[c].e);
        v();
        v();
        v();
        v();
        v();
      }
  return 0;
}
static int *ac(struct a ad) {
  for (; ad.b; ad.b--) {
    for (; ad.c;)
      x();
    w();
    for (; m;)
      ;
    v();
    n &= l && o;
    v();
    v();
    v();
    v();
    v();
    for (int f = 0; f < 8; f++)
      for (int j = 0; j < 8; j++)
        for (int p = 0; p < 4; p++)
          v();
    v();
  }
  v();
  v();
  return 0;
}
int *x() {
  y();
  v();
  v();
  for (int q = 0; q < 4; q++)
    for (int r = 0; r < 10; r++)
      v();
  v();
  return 0;
}
unsigned char y() {
  aa();
  z();
  v();
  return 0;
}
int *aa() {
  for (; i;) {
    struct a s[80];
    ab();
    v();
    v();
    v();
    v();
    v();
    v();
    for (int t = 0; t < 10; t++) {
      v();
      v();
      v();
      if (s[t].e)
        printf(&k, g ^ 5UL);
      v();
      v();
    }
  }
  return 0;
}
int main() {
  struct a u = {9};
  ac(u);
}
$
$ icx -O0 -mcmodel=large -fPIC test.c; ./a.out
$ icx -O2 -mcmodel=large -fPIC test.c; ./a.out
$ icx -O3 -mcmodel=large -fPIC test.c; ./a.out
$ icx -Os -mcmodel=large -fPIC test.c; ./a.out
$
$ icx -O1 test.c; ./a.out
$
$ icx -O1 -mcmodel=large test.c
$ ./a.out
(Timeout)
$
$ icx -O1 -fPIC test.c
$ ./a.out
(Timeout)
$
$ icx -O1 -mcmodel=large -fPIC test.c
$ ./a.out
(Timeout)
$
$ icx --version
Intel(R) oneAPI DPC++/C++ Compiler 2023.2.0 (2023.2.0.20230622)
Target: x86_64-unknown-linux-gnu

Best regards,

Junwei Zeng.

Labels (1)
0 Kudos
1 Solution
NoorjahanSk_Intel
Moderator
343 Views

Hi,


This issue has been targeted to be fixed in oneAPI 2024.0 version which will be released in the coming months. If the issue still persists with the new release, then you can start a new discussion for the community to investigate.


Please check the below Release notes for all the updates regarding the Intel oneAPI

https://www.intel.com/content/www/us/en/developer/articles/release-notes/intel-oneapi-toolkit-release-notes.html


Please let us know if we can go ahead and close this case.


Thanks & Regards,

Noorjahan.


View solution in original post

0 Kudos
4 Replies
NoorjahanSk_Intel
Moderator
414 Views

Hi,


Thanks for posting in Intel Communities.

We are also able to reproduce the issue at our end. We have reported this issue to the concerned development team. They are looking into your issue.


Thanks & Regards,

Noorjahan.


0 Kudos
NoorjahanSk_Intel
Moderator
344 Views

Hi,


This issue has been targeted to be fixed in oneAPI 2024.0 version which will be released in the coming months. If the issue still persists with the new release, then you can start a new discussion for the community to investigate.


Please check the below Release notes for all the updates regarding the Intel oneAPI

https://www.intel.com/content/www/us/en/developer/articles/release-notes/intel-oneapi-toolkit-release-notes.html


Please let us know if we can go ahead and close this case.


Thanks & Regards,

Noorjahan.


0 Kudos
Junwei_Zeng
Beginner
309 Views
Hi,

Thank you for your prompt reply and confirmation. It's great to hear that this issue has been targeted to be fixed in the Intel oneAPI 2024.0 version.

Once the new version is available, I'll thoroughly test it to ensure the issue has been resolved. Should any concerns persist, I won't hesitate to reach out and seek further assistance from the community.

Again, thank you for your assistance in this matter.

Best regards,
Junwei Zeng.
0 Kudos
NoorjahanSk_Intel
Moderator
306 Views

Hi,


Thanks for your confirmation.

If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Thanks & Regards,

Noorjahan.


0 Kudos
Reply