Recent

Author Topic: Free Pascal IDE, Runtime error 4216927?!  (Read 3771 times)

Rick314

  • New Member
  • *
  • Posts: 28
Free Pascal IDE, Runtime error 4216927?!
« on: February 27, 2015, 03:27:45 am »
See the 2 attached images and test code below.  Between the two images is a "Step Over" (F8 in the IDE).  Prod64 : QWord (64-bit unsigned) has value 3618239625 = $00000000d7a9f489.  I want to put the 32 LS bits into TempDivIntoIt : Longint (32-bit signed).  Executing the test code below produces the desired output "3618239625 -676727671", but the single-step in the IDE produces Run Time Error 4216927, Error Address $00000000, loss of Watch Window values, and what appears to be a messed up call stack.

How do I to interpret these results?

What should my path forward be?  (Bug report?  Workarounds?  Debugging suggestions? ...)


program bugtest;
var
   TempDivIntoIt :Longint;
   Prod64 :QWord;
begin
   Prod64 := 3618239625;
   TempDivIntoIt := Longword(Prod64);
   writeln(Prod64, ' ', TempDivIntoIt);
end.

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Free Pascal IDE, Runtime error 4216927?!
« Reply #1 on: February 27, 2015, 04:26:06 am »
How do I to interpret these results?

I don't use this IDE, but based on the call stack in the second image, it is a range check error (fpc_rangeerror). The error message is vague. The error happened because of the typecast Longword(Prod64). A proposed solution is to bypass the check at this point:
Code: [Select]
   {$Push}
   {$RangeChecks Off}
   TempDivIntoIt := Longword(Prod64);
   {$Pop}

Rick314

  • New Member
  • *
  • Posts: 28
Re: Free Pascal IDE, Runtime error 4216927?!
« Reply #2 on: February 27, 2015, 05:55:03 am »
Thank you engkin.  Your suggestion allowed me to go forward and continue what I was doing.

 

TinyPortal © 2005-2018