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

problem writing allocatable two-dimensional array

Terry_Wong
Beginner
686 Views

I am currently using Intel Visual Fortran w_fcompxe_2013_sp1.0.103.

I am trying to write out the contents of a multi-dimensional allocatable array using array notation.  The lower bound of the first dimension is not 1.  However, there seems to be an indexing bug in the compiler.

For example, I declare the array

integer, dimension(:,:), allocatable :: itestarray

Then, I allocate the array.

allocate(itestarray(2:5,3)).

I then fill the array with sequential integers from 1 to 12.

I then write the array out using the syntax

write(6,*) itestarray(:,1:3)

I obtain the following result:

1 2 3 4 6 7 8 9 11 12 -1163005939 -1410400530

Apparently, the first column prints alright.  However, on subsequent columns, we are skipping one element for each column.  Eventually, we get a garbage result for the last two elements.

The array however writes out correctly if we use

write(6,*) itestarray

or

write(6,*) itestarray(:,:)

or

write(6,*) itestarray(lbound(itestarray,1):, 1:3)

 

 

0 Kudos
4 Replies
jimdempseyatthecove
Honored Contributor III
686 Views

-deleted-

Jim Dempsey

0 Kudos
Martyn_C_Intel
Employee
686 Views

This looks like a bug to me. It's seen only in the compiler for IA-32, not in the one for Intel64 with 64 bit OS. I will escalate to engineering to be fixed. In the meantime, you've already figured out the straightforward workarounds.

Thanks for the report.

0 Kudos
Martyn_C_Intel
Employee
686 Views

On further testing, I found that this was already fixed in the first update to the 14.0 compiler, 14.0.1.139, so I don't think there's anything for engineering to do here. If your support is current, you should be able to download the updated compiler from registrationcenter.intel.com.

0 Kudos
Terry_Wong
Beginner
686 Views

Thanks, I have downloaded the update, and everything works fine now.

0 Kudos
Reply