[Lazarus] Runtime error: INCLOCKED

Valdas Jankūnas zmuogs at gmail.com
Sun Apr 29 18:16:12 CEST 2018


Hello,

I'm stuck. I always getting weird error when executing this code (stripped down to minimum):

program project1;

type
   TElement = record
       strr: String;
   end;
   TList = array of TElement;
   Plist = ^TList;

   TSetting = record
       list: Plist;
   end;

const
   _List: array [0..1] of TElement = (
       (strr: 'a'),
       (strr: 'b'));

   _Settings: array [0..0] of TSetting = (
       (list: @_List));

procedure Display(a: TList);
begin // <-------------------------------- line 23
     writeln(' +++  ', a[0].strr);
end;

var
   setting: TSetting;
begin
     setting := _Settings[0];
writeln(' ----  ', Assigned(setting.list), '  ', Length(setting.list^));
     Display(setting.list^);

end.


In console I get:

  ----  TRUE  2
Runtime error 216 at $0000000000400BD5
   $0000000000400BD5  INCLOCKED
   $0000000000400216  DISPLAY,  line 23 of project1.lpr
   $0000000000400360  main,  line 32 of project1.lpr
   $000000000042BE00  SYSENTRY,  line 129 of system.pp
   $00000000004001D2


Why I getting that error? Something wrong with records and constant initialization?

My system is: Linux 4.13.0-39-generic #44-Ubuntu SMP Thu Apr 5 14:25:01 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
FPC (from SVN): 3.1.1 [2018/02/21] for x86_64

-- 
   Valdas Jankūnas


More information about the Lazarus mailing list