POV-Ray : Newsgroups : povray.beta-test : Array assignment crash Server Time
2 Nov 2024 16:54:48 EDT (-0400)
  Array assignment crash (Message 1 to 2 of 2)  
From: Slime
Subject: Array assignment crash
Date: 16 Oct 2001 11:39:23
Message: <3bcc54ab$1@news.povray.org>
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

- Slime
[ http://www.slimeland.com/ ]
[ http://www.slimeland.com/images/ ]


Post a reply to this message

From: Mike Williams
Subject: Re: Array assignment crash
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.