Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
20 Views

Fortran Visual studio 2013 array syntax

Jump to solution

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

Accepted Solutions
Highlighted
Black Belt Retired Employee
20 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
Highlighted
Black Belt Retired Employee
21 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
Highlighted
Beginner
20 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
Highlighted
Black Belt Retired Employee
20 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