Recent

Author Topic: Compiler raised internal error when compiling RISCV and LoongArch  (Read 771 times)

TYDQ

  • Full Member
  • ***
  • Posts: 134
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][+][-]
  1. Error: Compilation raised exception internally
  2. An unhandled exception occurred at $0000000000465BB7:
  3. EListError: List index exceeds bounds (0)
  4. $0000000000465BB7
  5. $0000000000465BF2
  6. $00000000006222D9
  7. $00000000006BA8EE
  8. $00000000006235A1
  9. $00000000006A6CA4
  10. $00000000006235A1
  11. $00000000006B5FD5
  12. $00000000006B7688
  13. $00000000006B90EE
  14. $00000000006B7655
  15. $00000000006B7D34
  16. $00000000006235A1
  17. $00000000005E994D
  18. $00000000006235A1
  19. $00000000006A1EEA
  20. $00000000006235A1
  21. fpintres.pas(3,10) Fatal: Internal error 2006012304
  22. Fatal: Compilation aborted
  23. sysinit.pas(3,10) Fatal: Internal error 2006012304
  24. Fatal: Compilation aborted
  25. si_prc.pas(3,10) Fatal: Internal error 2006012304
  26. Fatal: Compilation aborted
  27. kernel.pas(1,16) Fatal: Internal error 2006012304
  28. Fatal: Compilation aborted
These 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.
« Last Edit: May 18, 2025, 06:03:40 pm by TYDQ »

Fibonacci

  • Hero Member
  • *****
  • Posts: 757
  • Internal Error Hunter
Re: Compiler raised internal error when compiling RISCV and LoongArch
« Reply #1 on: May 18, 2025, 10:53:17 pm »
Code: Pascal  [Select][+][-]
  1. system.pas(2222,34) Error: Compilation raised exception internally
  2. Fatal: Compilation aborted
  3. An unhandled exception occurred at $00420C9F:
  4. EListError: List index exceeds bounds (0)
  5.   $00420C9F  TFPLIST__RAISEINDEXERROR,  line 716 of cclasses.pas
  6.   $00420CD7  TFPLIST__GET,  line 722 of cclasses.pas
  7.   $00451981  TCPUPARAMANAGER__GETCGTEMPPARALOC,  line 77 of ./loongarch64/cpupara.pas
  8.   $005C4A8A  TCGMODDIVNODE__PASS_GENERATE_CODE,  line 453 of ncgmat.pas
  9.   $0057478B  SECONDPASS,  line 216 of pass_2.pas
  10.   $005B6E14  TCGTYPECONVNODE__PASS_GENERATE_CODE,  line 851 of ncgcnv.pas
  11.   $0057478B  SECONDPASS,  line 216 of pass_2.pas
  12.   $005C298F  TCGADDNODE__PASS_LEFT_RIGHT,  line 104 of ncgadd.pas
  13.   $005C3A0D  TCGADDNODE__SECOND_ADDORDINAL,  line 667 of ncgadd.pas
  14.   $005C1016  TLOONGARCH64ADDNODE__SECOND_ADDORDINAL,  line 258 of ./loongarch64/ncpuadd.pas
  15.   $005C39E4  TCGADDNODE__SECOND_OPORDINAL,  line 653 of ncgadd.pas
  16.   $005C3F3C  TCGADDNODE__PASS_GENERATE_CODE,  line 828 of ncgadd.pas
  17.   $0057478B  SECONDPASS,  line 216 of pass_2.pas
  18.   $0054926B  TCGDEREFNODE__PASS_GENERATE_CODE,  line 263 of ncgmem.pas
  19.   $0057478B  SECONDPASS,  line 216 of pass_2.pas
  20.   $005B34F4  TCGASSIGNMENTNODE__PASS_GENERATE_CODE,  line 762 of ncgld.pas
  21.   $0057478B  SECONDPASS,  line 216 of pass_2.pas

Compiles if you comment out these lines:

Code: Pascal  [Select][+][-]
  1. 2222   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;
  2. 2223   tempnum1:=tempnum1 mod tempnum2;
  3. 2250   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;
  4. 2251   tempnum1:=tempnum1 mod tempnum2;
  5. 2327   (res+i-1)^:=(hexchar+tempnum1 div tempnum2)^;
  6. 2328   tempnum1:=tempnum1-(tempnum1 div tempnum2)*tempnum2;
  7. 2492   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;
  8. 2493   tempnum1:=tempnum1 mod tempnum2;
  9. 2520   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;
  10. 2521   tempnum1:=tempnum1 mod tempnum2;
  11. 2597   (res+i-1)^:=(Hexchar+tempnum1 div tempnum2)^;
  12. 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 >:D
« Last Edit: May 18, 2025, 11:21:09 pm by Fibonacci »

TYDQ

  • Full Member
  • ***
  • Posts: 134
Re: Compiler raised internal error when compiling RISCV and LoongArch
« Reply #2 on: May 19, 2025, 02:48:36 am »
Code: Pascal  [Select][+][-]
  1. system.pas(2222,34) Error: Compilation raised exception internally
  2. Fatal: Compilation aborted
  3. An unhandled exception occurred at $00420C9F:
  4. EListError: List index exceeds bounds (0)
  5.   $00420C9F  TFPLIST__RAISEINDEXERROR,  line 716 of cclasses.pas
  6.   $00420CD7  TFPLIST__GET,  line 722 of cclasses.pas
  7.   $00451981  TCPUPARAMANAGER__GETCGTEMPPARALOC,  line 77 of ./loongarch64/cpupara.pas
  8.   $005C4A8A  TCGMODDIVNODE__PASS_GENERATE_CODE,  line 453 of ncgmat.pas
  9.   $0057478B  SECONDPASS,  line 216 of pass_2.pas
  10.   $005B6E14  TCGTYPECONVNODE__PASS_GENERATE_CODE,  line 851 of ncgcnv.pas
  11.   $0057478B  SECONDPASS,  line 216 of pass_2.pas
  12.   $005C298F  TCGADDNODE__PASS_LEFT_RIGHT,  line 104 of ncgadd.pas
  13.   $005C3A0D  TCGADDNODE__SECOND_ADDORDINAL,  line 667 of ncgadd.pas
  14.   $005C1016  TLOONGARCH64ADDNODE__SECOND_ADDORDINAL,  line 258 of ./loongarch64/ncpuadd.pas
  15.   $005C39E4  TCGADDNODE__SECOND_OPORDINAL,  line 653 of ncgadd.pas
  16.   $005C3F3C  TCGADDNODE__PASS_GENERATE_CODE,  line 828 of ncgadd.pas
  17.   $0057478B  SECONDPASS,  line 216 of pass_2.pas
  18.   $0054926B  TCGDEREFNODE__PASS_GENERATE_CODE,  line 263 of ncgmem.pas
  19.   $0057478B  SECONDPASS,  line 216 of pass_2.pas
  20.   $005B34F4  TCGASSIGNMENTNODE__PASS_GENERATE_CODE,  line 762 of ncgld.pas
  21.   $0057478B  SECONDPASS,  line 216 of pass_2.pas

Compiles if you comment out these lines:

Code: Pascal  [Select][+][-]
  1. 2222   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;
  2. 2223   tempnum1:=tempnum1 mod tempnum2;
  3. 2250   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;
  4. 2251   tempnum1:=tempnum1 mod tempnum2;
  5. 2327   (res+i-1)^:=(hexchar+tempnum1 div tempnum2)^;
  6. 2328   tempnum1:=tempnum1-(tempnum1 div tempnum2)*tempnum2;
  7. 2492   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;
  8. 2493   tempnum1:=tempnum1 mod tempnum2;
  9. 2520   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;
  10. 2521   tempnum1:=tempnum1 mod tempnum2;
  11. 2597   (res+i-1)^:=(Hexchar+tempnum1 div tempnum2)^;
  12. 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 >:D
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

  • Full Member
  • ***
  • Posts: 134
Re: Compiler raised internal error when compiling RISCV and LoongArch
« Reply #3 on: May 19, 2025, 03:27:23 am »
Code: Pascal  [Select][+][-]
  1. system.pas(2222,34) Error: Compilation raised exception internally
  2. Fatal: Compilation aborted
  3. An unhandled exception occurred at $00420C9F:
  4. EListError: List index exceeds bounds (0)
  5.   $00420C9F  TFPLIST__RAISEINDEXERROR,  line 716 of cclasses.pas
  6.   $00420CD7  TFPLIST__GET,  line 722 of cclasses.pas
  7.   $00451981  TCPUPARAMANAGER__GETCGTEMPPARALOC,  line 77 of ./loongarch64/cpupara.pas
  8.   $005C4A8A  TCGMODDIVNODE__PASS_GENERATE_CODE,  line 453 of ncgmat.pas
  9.   $0057478B  SECONDPASS,  line 216 of pass_2.pas
  10.   $005B6E14  TCGTYPECONVNODE__PASS_GENERATE_CODE,  line 851 of ncgcnv.pas
  11.   $0057478B  SECONDPASS,  line 216 of pass_2.pas
  12.   $005C298F  TCGADDNODE__PASS_LEFT_RIGHT,  line 104 of ncgadd.pas
  13.   $005C3A0D  TCGADDNODE__SECOND_ADDORDINAL,  line 667 of ncgadd.pas
  14.   $005C1016  TLOONGARCH64ADDNODE__SECOND_ADDORDINAL,  line 258 of ./loongarch64/ncpuadd.pas
  15.   $005C39E4  TCGADDNODE__SECOND_OPORDINAL,  line 653 of ncgadd.pas
  16.   $005C3F3C  TCGADDNODE__PASS_GENERATE_CODE,  line 828 of ncgadd.pas
  17.   $0057478B  SECONDPASS,  line 216 of pass_2.pas
  18.   $0054926B  TCGDEREFNODE__PASS_GENERATE_CODE,  line 263 of ncgmem.pas
  19.   $0057478B  SECONDPASS,  line 216 of pass_2.pas
  20.   $005B34F4  TCGASSIGNMENTNODE__PASS_GENERATE_CODE,  line 762 of ncgld.pas
  21.   $0057478B  SECONDPASS,  line 216 of pass_2.pas

Compiles if you comment out these lines:

Code: Pascal  [Select][+][-]
  1. 2222   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;
  2. 2223   tempnum1:=tempnum1 mod tempnum2;
  3. 2250   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;
  4. 2251   tempnum1:=tempnum1 mod tempnum2;
  5. 2327   (res+i-1)^:=(hexchar+tempnum1 div tempnum2)^;
  6. 2328   tempnum1:=tempnum1-(tempnum1 div tempnum2)*tempnum2;
  7. 2492   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;
  8. 2493   tempnum1:=tempnum1 mod tempnum2;
  9. 2520   (res+i-1)^:=(numchar+tempnum1 div tempnum2)^;
  10. 2521   tempnum1:=tempnum1 mod tempnum2;
  11. 2597   (res+i-1)^:=(Hexchar+tempnum1 div tempnum2)^;
  12. 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 >:D
And If I replaced "RaiseIndexError" in this unit with exit,I will get an Access Violation Error.

 

TinyPortal © 2005-2018