- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I try to make use of the new Array Notation to simplify/vectorize my code. However, it seems that it works as expected only if I use -O0.Let me show a very simple C code and its output that illustrates the problem. I create an array with some values, copy it to a new array and finally I dump both arrays to screen:
[csharp]#include#define N 4 int main(void){ int i,j; int c0 ,c1 ; c0[:][:] = 0; c0[1:2][1:2] = 1; c1[:][:] = c0[:][:]; for(i=0;i ); } printf("\n"); } printf("\n"); for(i=0;i ); } printf("\n"); } }[/csharp]
If I compile the above code with "icc -O0 test.c" the output is
[bash] 0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 [/bash]
as I expect, while if I compile it with"icc -O3 test.c" (or -O1 or -O2) the output is different:
[bash] 0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [/bash]
I tried it with float arrays instead of int, with different sizes, etc. Similar results.
What am I doing wrong? Is there an extra compile option or an extra line I have to insert into my code that I'm nor aware of?
Thanks for your help.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, I forgot to mention that my compiler version is I think the most recent: 12.0.0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This might be a bug. I'll look into it and get back to you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This problem is resolve with the latest Composer XE product update 1.

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