- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am building main.c (attached) with icx
Intel(R) oneAPI DPC++/C++ Compiler 2023.2.0 (2023.2.0.20230622)
The expected output of the program is "0 1 2 3 4 5 6 7." However, when compiled with -O2, the application returns incorrect data. We suspect that icx is reversing the loop at L22-L23 and this results in data corruption.
[cmelone@shepard-login-0-1 bug]$ icx -O1 main.c [cmelone@shepard-login-0-1 bug]$ ./a.out 0 1 2 3 4 5 6 7 [cmelone@shepard-login-0-1 bug]$ icx -O2 main.c [cmelone@shepard-login-0-1 bug]$ ./a.out 0 1 2 3 0 2 0 2.125
I am not able to reproduce this with icc.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Happens on oneAPI DPC++/C++ Compiler 2024.2 too, escalated the issue to our engineering team.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I reported the issue to our internal team. Will let you know when the issue is fixed.
Thanks,
Chen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
This is not a bug. The test case is violating ansi-alias semantics by casting (double * a) into (float *) and hence has undefined behavior. To get the same results as -O1, you can compile the code with option '-fno-strict-aliasing'.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page