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

icx error: wrong code (output `Segmentation fault`) at -O2 since `x86-64 icx 2023.2.0`

Junwei_Zeng
Beginner
640 Views
Hi,

I compiled the following code with icx at -O2, and it produces the wrong code, outputting the error `Segmentation fault (core dumped)`.
I found this bug was introduced starting from `x86-64 icx-2023.2.0`.

 

$ cat test.c
int c[56];
int f, a, d, h;
long b;
static int e;
static long k;
int *g = &a;
void l(char m) { f = c[(int) m]; }
void n() {
  long *i[] = {&k, &b};
  for (; e <= 4; e++) {
    short j = 5527;
    h = 0;
    for (; h <= 1; h++) {
      d = 0;
      for (; d <= 1; d++) {
        if (k)
          break;
        ++j;
      }
    }
    *g = e;
    l(j >> 8);
  }
}
int main() { n(); }
$
$ icx -O0 test.c; ./a.out
$ icx -O1 test.c; ./a.out
$ icx -Os test.c; ./a.out
$ icx -O3 test.c; ./a.out
$
$ icx -O2 test.c; ./a.out
Segmentation fault (core dumped)
$
$ gcc-13 -O2 test.c; ./a.out
$
$ icx --version
Intel(R) oneAPI DPC++/C++ Compiler 2023.2.0 (2023.2.0.20230622)
Target: x86_64-unknown-linux-gnu
$
$ gcc-13 --version
gcc (Compiler-Explorer-Build-gcc--binutils-2.40) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.

 

Best regards,

Junwei Zeng.

Labels (1)
0 Kudos
1 Solution
SeshaP_Intel
Moderator
380 Views

Hi,


Thank you for your patience. The issue raised by you has been targeted to be fixed in the oneAPI 2024.1 version which will 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.


Thanks and Regards,

Pendyala Sesha Srinivas


View solution in original post

0 Kudos
3 Replies
SeshaP_Intel
Moderator
589 Views

Hi,


Thank you for posting in Intel Communities.


We are working on your issue internally. We will get back to you soon.


Thanks and Regards,

Pendyala Sesha Srinivas


0 Kudos
SeshaP_Intel
Moderator
381 Views

Hi,


Thank you for your patience. The issue raised by you has been targeted to be fixed in the oneAPI 2024.1 version which will 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.


Thanks and Regards,

Pendyala Sesha Srinivas


0 Kudos
Junwei_Zeng
Beginner
307 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.1 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
Reply