POV-Ray : Newsgroups : povray.beta-test : Array assignment crash : Re: Array assignment crash Server Time
4 Nov 2024 13:02:10 EST (-0500)
  Re: Array assignment crash  
From: Mike Williams
Date: 26 Nov 2001 13:01:50
Message: <BspXUDAt9nA8EwbF@econym.demon.co.uk>
Wasn't it Slime who wrote:
>The following scene causes POV-Ray to crash because of an array assignment
>(read the comments):
>
>#declare pointarray = array[5] {<0,0>,<0,1>,<2,1>,<3,0>,<2,.5>};
>
>#local dim = dimension_size(pointarray,1);
>
>// if the last point in the array isn't the same as the first point...
>#if (pointarray[dim-1].u != pointarray[0].u & pointarray[dim-1].v !=
>pointarray[0].v)
>
> //... then add a point to the array that's identical to the first point.
> #local correctarray = array[dim+1];
> #local copying = 0;
> #while (copying < dim)
>  #local correctarray[copying] = pointarray[copying];
>  #local copying = copying + 1;
> #end
> #local correctarray[dim] = pointarray[0];
>
> // The following line causes POV-Ray to crash (semi-colon or no
>semi-colon).
> // It should overwrite the old array with the newly created, correct
> // array, which has a dimension one size bigger.
> #local pointarray = correctarray;
>
> #local dim = dim+1;
>#end

I've just been wading through some of the old unconfirmed bugs, and
noticed this one. The above code does cause beta 7 to crash, but
redimensioning the array doesn't seem to be the cause. The following
scene also crashes beta 7, but no arrays are redimensioned.


#declare pointarray = array[5] {<0,0>,<0,1>,<2,1>,<3,0>,<2,.5>};

 #local myarray = array[6];
 #local i = 0;
 #local myarray[5] = pointarray[0];

 // The following line causes POV-Ray to crash
 
 #local newarray = myarray;



The crash only seems to happen with 2d vectors. Arrays of floats, and
arrays of 3d vectors, 4d vectors etc. seem to be OK.

Oddly, if the "#local i = 1;" is removed, it doesn't crash.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.