Compiler raised internal error when compiling RISCV and LoongArch lazarus / 64-FPC development ---------------------------------------------------------------------- TYDQ · 2025-05-18 16:00 These days I have tried to compile my DIY efi app(Absolutely efi app,can only be executed in UEFI Firmware)(compiled elf file Will be translated to efi file,fpc compile the elf file and it will be translated to efi app by my elf2efi) as my app. However, compiler terminated compiling when compiling elf file for RISCV64 or LoongArch64 and give a error like this(LoongArch64 is same when using bash build.sh loongarch64,RISCV64 is using bash build.sh riscv64): (To build it easily,I write the build.sh,And my efi app source code and builds.sh in zip file is stubbed in this topic) Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Error: Compilation raised exception internallyAn unhandled exception occurred at $0000000000465BB7:EListError: List index exceeds bounds (0)$0000000 000465BB7$0000000000465BF2$00000000006222D9$00000000006BA8EE$000000000 06235A1$00000000006A6CA4$00000000006235A1$00000000006B5FD5$00000000006 B7688$00000000006B90EE$00000000006B7655$00000000006B7D34$0000000000623 5A1$00000000005E994D$00000000006235A1$00000000006A1EEA$00000000006235A 1fpintres.pas(3,10) Fatal: Internal error 2006012304Fatal: Compilation abortedsysinit.pas(3,10) Fatal: Internal error 2006012304Fatal: Compilation abortedsi_prc.pas(3,10) Fatal: Internal error 2006012304Fatal: Compilation abortedkernel.pas(1,16) Fatal: Internal error 2006012304Fatal: Compilation abortedThese error occurs when compiling RISCV and LoongArch ELF which FPC already supported,other platform cannot occur this problem,this error is architectures- specfic. I don't know whether my code is wrong or the fpc source code is wrong,I have compile the fpc source code by myself and git clone the fpc source code newest trunk.If my code is wrong,you should point out where. ---------------------------------------------------------------------- Fibonacci · 2025-05-18 20:53 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 system.pas(2222,34) Error: Compilation raised exception internallyFatal: Compilation abortedAn unhandled exception occurred at $00420C9F:EListError: List index exceeds bounds (0)  $00420C9F  TFPLIST__RAISEINDEXERROR,  line 716 of cclasses.pas  $00420CD7  TFPLIST__GET,  line 722 of cclasses.pas  $00451981  TCPUPARAMANAGER__GETCGTEMPPARALOC,  line 77 of ./loongarch64/cpupara.pas  $005C4A8A  TCGMODDIVNODE__PASS_GENERATE_CODE,  line 453 of ncgmat.pas  $0057478B  SECONDPASS,  line 216 of pass_2.pas  $005B6E14  TCGTYPECONVNODE__PASS_GENERATE_CODE,  line 851 of ncgcnv.pas  $0057478B  SECONDPASS,  line 216 of pass_2.pas  $005C298F  TCGADDNODE__PASS_LEFT_RIGHT,  line 104 of ncgadd.pas  $005C3A0D  TCGADDNODE__SECOND_ADDORDINAL,  line 667 of ncgadd.pas  $005C1016  TLOONGARCH64ADDNODE__SECOND_ADDORDINAL,  line 258 of ./loongarch64/ncpuadd.pas  $005C39E4  TCGADDNODE__SECOND_OPORDINAL,  line 653 of ncgadd.pas  $005C3F3C  TCGADDNODE__PASS_GENERATE_CODE,  line 828 of ncgadd.pas  $0057478B  SECONDPASS,  line 216 of pass_2.pas  $0054926B  TCGDEREFNODE__PASS_GENERATE_CODE,  line 263 of ncgmem.pas  $0057478B  SECONDPASS,  line 216 of pass_2.pas  $005B34F4  TCGASSIGNMENTNODE__PASS_GENERATE_CODE,  line 762 of ncgld.pas  $0057478B  SECONDPASS,  line 216 of pass_2.pas Compiles if you comment out these lines: 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 2222   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;2223   tempnum1:=tempnum1 mod tempnum2;2250   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;2251 tempnum1:=tempnum1 mod tempnum2;2327   (res+i-1)^:=(hexchar+tempnum1 div tempnum2)^;2328   tempnum1:=tempnum1-(tempnum1 div tempnum2)*tempnum2;2492   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;2493   tempnum1:=tempnum1 mod tempnum2;2520   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;2521   tempnum1:=tempnum1 mod tempnum2;2597   (res+i-1)^:=(Hexchar+tempnum1 div tempnum2)^;2598 tempnum1:=tempnum1-(tempnum1 div tempnum2)*tempnum2; As for IE 2006012304 - it means "compile system.pas first". I remember some time ago I had exactly the same error ("List index exceeds bounds"), I had no idea what was wrong with the code, so I replaced "RaiseIndexError" in compiler/cclasses.pas with "exit" and it worked. Unknown side effects ---------------------------------------------------------------------- TYDQ · 2025-05-19 00:48 Quote from: Fibonacci on May 18, 2025, 10:53:17 pmCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i system.pas(2222,34) Error: Compilation raised exception internallyFatal: Compilation abortedAn unhandled exception occurred at $00420C9F:EListError: List index exceeds bounds (0)  $00420C9F  TFPLIST__RAISEINDEXERROR,  line 716 of cclasses.pas  $00420CD7  TFPLIST__GET,  line 722 of cclasses.pas  $00451981  TCPUPARAMANAGER__GETCGTEMPPARALOC,  line 77 of ./loongarch64/cpupara.pas  $005C4A8A  TCGMODDIVNODE__PASS_GENERATE_CODE,  line 453 of ncgmat.pas  $0057478B  SECONDPASS,  line 216 of pass_2.pas  $005B6E14  TCGTYPECONVNODE__PASS_GENERATE_CODE,  line 851 of ncgcnv.pas  $0057478B  SECONDPASS,  line 216 of pass_2.pas  $005C298F  TCGADDNODE__PASS_LEFT_RIGHT,  line 104 of ncgadd.pas  $005C3A0D  TCGADDNODE__SECOND_ADDORDINAL,  line 667 of ncgadd.pas  $005C1016  TLOONGARCH64ADDNODE__SECOND_ADDORDINAL,  line 258 of ./loongarch64/ncpuadd.pas  $005C39E4  TCGADDNODE__SECOND_OPORDINAL,  line 653 of ncgadd.pas  $005C3F3C  TCGADDNODE__PASS_GENERATE_CODE,  line 828 of ncgadd.pas  $0057478B  SECONDPASS,  line 216 of pass_2.pas  $0054926B  TCGDEREFNODE__PASS_GENERATE_CODE,  line 263 of ncgmem.pas  $0057478B  SECONDPASS,  line 216 of pass_2.pas  $005B34F4  TCGASSIGNMENTNODE__PASS_GENERATE_CODE,  line 762 of ncgld.pas  $0057478B  SECONDPASS,  line 216 of pass_2.pas Compiles if you comment out these lines: 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 2222   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;2223   tempnum1:=tempnum1 mod tempnum2;2250   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;2251 tempnum1:=tempnum1 mod tempnum2;2327   (res+i-1)^:=(hexchar+tempnum1 div tempnum2)^;2328   tempnum1:=tempnum1-(tempnum1 div tempnum2)*tempnum2;2492   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;2493   tempnum1:=tempnum1 mod tempnum2;2520   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;2521   tempnum1:=tempnum1 mod tempnum2;2597   (res+i-1)^:=(Hexchar+tempnum1 div tempnum2)^;2598 tempnum1:=tempnum1-(tempnum1 div tempnum2)*tempnum2; As for IE 2006012304 - it means "compile system.pas first". I remember some time ago I had exactly the same error ("List index exceeds bounds"), I had no idea what was wrong with the code, so I replaced "RaiseIndexError" in compiler/cclasses.pas with "exit" and it worked. Unknown side effects So how to translate the number to PChar or PWideChar in RISCV or LoongArch Correctly?Without these function I cannot translate the number to PChar or PWideChar in these architecture. ---------------------------------------------------------------------- TYDQ · 2025-05-19 01:27 Quote from: Fibonacci on May 18, 2025, 10:53:17 pmCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i system.pas(2222,34) Error: Compilation raised exception internallyFatal: Compilation abortedAn unhandled exception occurred at $00420C9F:EListError: List index exceeds bounds (0)  $00420C9F  TFPLIST__RAISEINDEXERROR,  line 716 of cclasses.pas  $00420CD7  TFPLIST__GET,  line 722 of cclasses.pas  $00451981  TCPUPARAMANAGER__GETCGTEMPPARALOC,  line 77 of ./loongarch64/cpupara.pas  $005C4A8A  TCGMODDIVNODE__PASS_GENERATE_CODE,  line 453 of ncgmat.pas  $0057478B  SECONDPASS,  line 216 of pass_2.pas  $005B6E14  TCGTYPECONVNODE__PASS_GENERATE_CODE,  line 851 of ncgcnv.pas  $0057478B  SECONDPASS,  line 216 of pass_2.pas  $005C298F  TCGADDNODE__PASS_LEFT_RIGHT,  line 104 of ncgadd.pas  $005C3A0D  TCGADDNODE__SECOND_ADDORDINAL,  line 667 of ncgadd.pas  $005C1016  TLOONGARCH64ADDNODE__SECOND_ADDORDINAL,  line 258 of ./loongarch64/ncpuadd.pas  $005C39E4  TCGADDNODE__SECOND_OPORDINAL,  line 653 of ncgadd.pas  $005C3F3C  TCGADDNODE__PASS_GENERATE_CODE,  line 828 of ncgadd.pas  $0057478B  SECONDPASS,  line 216 of pass_2.pas  $0054926B  TCGDEREFNODE__PASS_GENERATE_CODE,  line 263 of ncgmem.pas  $0057478B  SECONDPASS,  line 216 of pass_2.pas  $005B34F4  TCGASSIGNMENTNODE__PASS_GENERATE_CODE,  line 762 of ncgld.pas  $0057478B  SECONDPASS,  line 216 of pass_2.pas Compiles if you comment out these lines: 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 2222   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;2223   tempnum1:=tempnum1 mod tempnum2;2250   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;2251 tempnum1:=tempnum1 mod tempnum2;2327   (res+i-1)^:=(hexchar+tempnum1 div tempnum2)^;2328   tempnum1:=tempnum1-(tempnum1 div tempnum2)*tempnum2;2492   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;2493   tempnum1:=tempnum1 mod tempnum2;2520   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;2521   tempnum1:=tempnum1 mod tempnum2;2597   (res+i-1)^:=(Hexchar+tempnum1 div tempnum2)^;2598 tempnum1:=tempnum1-(tempnum1 div tempnum2)*tempnum2; As for IE 2006012304 - it means "compile system.pas first". I remember some time ago I had exactly the same error ("List index exceeds bounds"), I had no idea what was wrong with the code, so I replaced "RaiseIndexError" in compiler/cclasses.pas with "exit" and it worked. Unknown side effects And If I replaced "RaiseIndexError" in this unit with exit,I will get an Access Violation Error.