Crash after changing dimension of array

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
jonasdovern
Posts: 97
Joined: Sat Apr 11, 2009 10:30 am

Crash after changing dimension of array

Unread post by jonasdovern »

I have the following problem: Consider the following procedure that I wrote for demonstration purposes:

Code: Select all

procedure testproc
	option ser[vec[vec]] array
	option integer       size
	*
	local ser[vec[vec]] larray
	local vec[vec]      lvec
	local integer       k i
	*
	dim lvec(size)
	gset larray 1 10 = lvec
	*
	do k=1,10
		do i=1,size
			dim larray(k)(i)(5)
			comp larray(k)(i) = %const(1.)
		end do i
	end do k
	gset array 1 10 = larray(t)
end procedure
RATS crashes (shuts down completely under Windows) without giving an error messages whenever I run this twice with changing "size".

Code: Select all

decl ser[vec[vec]] test
@testproc(array=test,size=5)
@testproc(array=test,size=4)
I would like the procedure to work when the output array hasn't been used before - but also when it has been used before with another dimension. Is there a way of avoiding these crashes?
Post Reply