Recent

Author Topic: My DIY dynamic array occurs internal error 2013060101 and I don't know WHY  (Read 235 times)

TYDQ

  • Full Member
  • ***
  • Posts: 134
These days I have developing my Testing OS and want to use my DIY dynamic array using fpc compilerproc.
However,I met the error about Internal Error 2013060101 and I find the destination about internal error raises using grep -r 2013060101:
These are the code where error occurs in fpc source code:
Code: Pascal  [Select][+][-]
  1. procedure tparamanager.getcgtempparaloc(list: TAsmList; pd: tabstractprocdef; nr : longint; var cgpara: tcgpara);
  2.       begin
  3.         if (nr<1) or (nr>pd.paras.count) then
  4.           InternalError(2013060101);
  5.         pd.init_paraloc_info(callerside);
  6.         cgpara:=tparavarsym(pd.paras[nr-1]).paraloc[callerside].getcopy;
  7.       end;
  8.  
And this is what function that occurs error:
Code: Pascal  [Select][+][-]
  1. procedure fpc_dynarray_assign(var Dest:Pointer;Source:Pointer;TypeInfo:Pointer);compilerproc;
  2. begin
  3.  fpc_dynamic_array_increase_reference(Source); freemem(Dest); Dest:=Source;
  4. end;
And this is the error appears in kernel.pas in my attachments.(If I change testarray1,testarray2 as global variable,the error still occurs as the same.)
Code: Pascal  [Select][+][-]
  1. procedure kernel_main;
  2. var testarray1,testarray2:array of Natuint;
  3. begin //where the error occurs(this line is line 9,kernel.pas(9,1):Internal Error 2013060101)
  4.  testarray1:=[1,3,7,13,21,31];
  5.  testarray2:=copy(testarray1,1,3);
  6.  while True do;
  7. end;
Furthermore,When I put the Dynamic Array Variable to the global variable,the error will disappear like this(If I put the testarray1,testarray2 as temporary variable,the error will occur above):
Code: Pascal  [Select][+][-]
  1. var testarray1,testarray2:array of Natuint;
  2.  
  3. procedure kernel_main;
  4. begin
  5.  SetLength(testarray1,6);
  6.  testarray1[0]:=1; testarray1[1]:=3; testarray1[2]:=7; testarray1[3]:=13; testarray1[4]:=21; testarray1[5]:=31;
  7.  testarray2:=copy(testarray1,1,3);
  8.  while True do;
  9. end;
I know this is my fault,but I don't know why and how to solve.
I know the forum have many free pascal geeks,so I put my problem for every forum members for the answer.
If you want to reshow this error,you can use bash build.sh in linux to show it.
This program is not to be executed due to memory does not have initialization process in this program,I compile it for testing and just want to pass the compile.
« Last Edit: June 12, 2025, 05:54:52 pm by TYDQ »

 

TinyPortal © 2005-2018