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.

Crash after changing dimension of array

Postby jonasdovern » Thu Jan 19, 2012 8:34 am

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?
jonasdovern
 
Posts: 68
Joined: Sat Apr 11, 2009 10:30 am

Return to Help With Programming

Who is online

Users browsing this forum: No registered users and 0 guests