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

Temporary copy of an array on WRITE

Jugoslav_Dujic
Valued Contributor II
883 Views
I'm not sure if this deserves a bug report, but I'd like to pay attention to it here. CVF 6.6B (and 6.6A) generates a temporary copy of an ALLOCATABLE array on WRITE to a binary file. The following causes a stack overflow on WRITE:
PROGRAM Test
INTEGER(1), ALLOCATABLE::  bits(:)
ALLOCATE(bits(1100000))
!INTEGER::  bits(1100000)

OPEN(11,FILE="Test.bin",FORM="Binary")
WRITE(11) bits(1:1100000)
CLOSE(11)

END PROGRAM

Stack overflow does not occur if the array is static; it does not occur when the array triplet (1:1100000) is ommitted either.

(If you've downloaded XFTGDI from my web page, this will happen on XSaveBitmap for a moderately large bitmap)

Jugoslav
0 Kudos
3 Replies
Steven_L_Intel1
Employee
883 Views
I've seen that... Omitting the subscript range is, as you note, the obvious alternative. It's already on our list to look at for future improvements.

Steve
0 Kudos
grtoro
Beginner
883 Views

I just found out the the problem also happens (in 6.6B) when doing a binary write of LARGE_STRUCTURE(1:N), even if the structure is allocated statically. Annoying!

Gabriel

0 Kudos
Jugoslav_Dujic
Valued Contributor II
883 Views

An implied do-loop instead of array section is a workaround if I recall correctly.

Annoying :-(.

(I didn't test it on latest IVF though.)

Jugoslav

0 Kudos
Reply