Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Fortran Visual studio 2013 array syntax

Lorenzo_W_
Beginner
384 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
Honored Contributor III
384 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

0 Kudos
3 Replies
Steve_Lionel
Honored Contributor III
385 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)

0 Kudos
Lorenzo_W_
Beginner
384 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

0 Kudos
Steve_Lionel
Honored Contributor III
384 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.

0 Kudos
Reply