Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Problem with restrict in C++ code

dehvidc1
Beginner
210 Views
I had some C++ code using restrict that was compiling and running OK on MS7 using a 11.x version of ICC.

restrict double *vecArray = (double *) vec.data();

When I try to compile this code on ICC version 12.0.0 on Linux I get an error message:

error: "restrict" is not allowed

I'm using the -restrict compile flag.

Within the relevant code block the restrict statement is semantically accurate. I had it in there to tell the compiler not to worry about any aliasing ie more aggressive optimisation if possible.

Am I getting the error due to a more restrictive analysis on the part of the newer compiler version of where restrict is allowed?

Thanks

David
0 Kudos
1 Solution
TimP
Black Belt
210 Views
The usual use of restrict to promote optimization would look like
double * restrict vecArray
i.e. restrict makes sense (to me) only in definition of a pointer.
It is true that the newer compilers are stricter on syntax analysis.

View solution in original post

1 Reply
TimP
Black Belt
211 Views
The usual use of restrict to promote optimization would look like
double * restrict vecArray
i.e. restrict makes sense (to me) only in definition of a pointer.
It is true that the newer compilers are stricter on syntax analysis.
Reply