Temporary copy of an array on WRITE

Temporary copy of an array on WRITE

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

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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

Retired 12/31/2016

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

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

Leave a Comment

Please sign in to add a comment. Not a member? Join today