Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26745 Discussions

Fortran Visual studio 2013 array syntax

Lorenzo_W_
Beginner
110 Views

I had an old fortran 90 code with the following command:

    data1(1:100) = data_all(:)

where "data_all" is a bigger array then "data1".
Since I know that this is not a robust syntax, it worked good when using Visual Studio 2008.

I recently switched to Visual Studio 2013, and I am not able to use this code anymore, since it tries to fill the 101th position of "data1".
How can I correctly change Compiler options to accept that?

 

Thank you!

0 Kudos
1 Solution
Steve_Lionel
Black Belt Retired Employee
110 Views

Fix your code. The shapes of the left and right side must match unless the left side is the name of an allocatable array. (Adding the (1:100) disqualifies it.) You can write instead:

data1(1:100) = data_all(1:100)

View solution in original post

3 Replies
Steve_Lionel
Black Belt Retired Employee
111 Views

Fix your code. The shapes of the left and right side must match unless the left side is the name of an allocatable array. (Adding the (1:100) disqualifies it.) You can write instead:

data1(1:100) = data_all(1:100)

View solution in original post

Lorenzo_W_
Beginner
110 Views

Dear Steve,
thanks for your kind reply.

I think you're right: maybe a compilator option previously allowed me to compile, but I agree with you that this code is bad written.

I Will fix it soon.

Thank you!

Lorenzo

Steve_Lionel
Black Belt Retired Employee
110 Views

Not an option, just an accident of the choice made by the code generator, which can change. Unfortunately, Intel Fortran doesn't yet do "shape checking", and it is unpredictable which size it will use on such erroneous assignments.

Reply