<div dir="ltr">Is there a known edge case issue connected to setting the length of dynamic arrays?<div><br></div><div>I have a program that simulates a billiards game, and during the rerack balls method of TPoolTable the number of pool balls on the table varies based on the rerack option used. Currently, I am having a problem where an exception is thrown if I try to SetLenth(Balls, 10) or greater than 10. Values less than 10 work fine, but at 10 balls and above an exception is thrown right at the SetLength call.</div><div><br></div><div>External: SIGSEGV<br></div><div><br></div><div><font face="monospace">000000000041DCA4 eb12                     jmp    0x41dcb8 <SYSTEM_$$_SYSGETMEM_VAR$QWORD$$POINTER+264><br>000000000041DCA6 4c89f0                   mov    %r14,%rax<br>000000000041DCA9 488b5008                 mov    0x8(%rax),%rdx<br>000000000041DCAD 488b4018                 mov    0x18(%rax),%rax<br>000000000041DCB1 488982a8000000           mov    %rax,0xa8(%rdx)</font><br></div><div><font face="monospace">^ instruction pointer is at this line ^</font></div><div><br></div><div>I tried compiler both FPC 3.3.1 from trunk source and 3.2.2 from the official Sourceforge binary.  The same error occurs when building with both compilers. My platform is x86_64 Linux.</div><div><br></div><div>For reference here is the type of Balls:<br></div><div><br></div><div><font face="monospace">  TVec2 = record</font></div><div><font face="monospace">     X, Y: Single;</font></div><div><font face="monospace">  end;</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">  TPoolBall = record<br>    Pos: TVec2;<br>    Dir: TVec2;<br>    Speed: Double;<br>    Color: LongWord;<br>    Touched: Boolean;<br>    Sinking: Single;<br>    SinkPocket: Integer;<br>    SinkPos: TVec2;<br>    Pocketed: Boolean;<br>    Index: Integer;<br>  end;<br><br>  TPoolBalls = array of TPoolBall; </font><br></div><div><font face="monospace"><br></font></div><div><span style="font-family:monospace">... later inside TPoolTable ...</span><br></div><div><span style="font-family:monospace"><br></span></div><div><font face="monospace">  Balls: </font><span style="font-family:monospace">TPoolBalls;</span></div></div>