Software Archive
Read-only legacy content
17061 Discussions

Array Notation doesn't work with -Ox x>0 for me

tpusztai
Beginner
678 Views
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.
0 Kudos
3 Replies
tpusztai
Beginner
678 Views
Sorry, I forgot to mention that my compiler version is I think the most recent: 12.0.0
0 Kudos
Quoc-An_L_Intel
Moderator
678 Views

This might be a bug. I'll look into it and get back to you.

0 Kudos
Quoc-An_L_Intel
Moderator
678 Views
This problem is resolve with the latest Composer XE product update 1.
0 Kudos
Reply