fpc_help_destructor related lazarus / 64-FPC development ---------------------------------------------------------------------- lagprogramming · 2015-10-28 21:34 fpc_help_destructor can be found within generic.inc Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure f pc_help_destructor(_self,_vmt:pointer;vmt_pos:cardinal);[public,alias: 'FPC_HELP_DESTRUCTOR'];  compilerproc;begin   { already released? }   if (_self=nil) or      (_vmt<>pointer(-1)) or      (ppointer(_self+vmt_pos)^=nil) then     exit;   if (pobjectvmt(ppointer(_self+vmt_pos)^)^.size=0) or      (pobjectvmt(ppo inter(_self+vmt_pos)^)^.size+pobjectvmt(ppointer(_self+vmt_pos)^)^.msi ze<>0) then     RunError(210);   { reset vmt to nil for protection }   ppointer(_self+vmt_pos)^:=nil;   freemem(_self);end;    The following line brought attention to me. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if (pobjectvmt(ppointer(_self+vmt_pos)^)^.size=0) or   (pobjectvmt(ppoint er(_self+vmt_pos)^)^.size+pobjectvmt(ppointer(_self+vmt_pos)^)^.msize< >0) then   RunError(210);    Both .size and .msize are unsigned integers. This means that we should always hit the "RunError(210);". Am I wrong? ---------------------------------------------------------------------- Jonas Maebe · 2015-10-28 22:32 FPC evaluates arithmetic using the native integer size. Those values have the native integer size and have values x and -x. Whether they are treated as signed or unsigned values doesn't matter, because in two's complement arithmetic using the native integer size, the sum will always be zero. ---------------------------------------------------------------------- lagprogramming · 2015-10-30 13:10 Quote from: Jonas Maebe on October 28, 2015, 11:32:40 pmFPC evaluates arithmetic using the native integer size. Those values have the native integer size and have values x and -x. Whether they are treated as signed or unsigned values doesn't matter, because in two's complement arithmetic using the native integer size, the sum will always be zero.    I'm still confused. How are overflow checks managed there, does "compilerproc" automatically turn off overflow checking? I think that with overflow checking turned on, "ppointer(_self+vmt_pos)^:=nil;" would never get executed. What assures that this check type is turned off there?    Example: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function test(const a,b:sizeuint):boolean;begin  result:=(a+b=0);//Fails with overflow checks turned onend;    when called with: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  x,y: sizeuint;begin  x:=1;  y:=sizeint(-1);  test(x,y);end; ---------------------------------------------------------------------- Jonas Maebe · 2015-10-30 13:39 The system unit is compiled without range and overflow checking, see systemh.inc. ---------------------------------------------------------------------- lagprogramming · 2015-10-30 16:49 Quote from: Jonas Maebe on October 30, 2015, 02:39:12 pmThe system unit is compiled without range and overflow checking, see systemh.inc. I've searched for the compiler directive within wrong files.  Now everything is crystal clear. Thank you Jonas!