Lazarus

Programming => General => Topic started by: paule32 on July 09, 2025, 01:18:55 pm

Title: internal Compiler Error
Post by: paule32 on July 09, 2025, 01:18:55 pm
Hello,
I have a Unit xmm.pas - when I try to compile it:

Code: Bash  [Select][+][-]
  1. T:\a>fpc.exe -dDLLEXPORT -dLANGDEU -dDLLDEBUG -n     -Twin64 -FE. -Fu. -O3 -Os xmm.pas

I get the following Error:

Code: Bash  [Select][+][-]
  1. xmm.pas(17,10) Error: Duplicate identifier "SYSTEM"
  2. xmm.pas(17,10) Error: Compilation raised exception internally
  3. Fatal: Compilation aborted
  4. An unhandled exception occurred at $00000001000615EC:
  5. EAccessViolation: Access violation
  6.   $00000001000615EC
  7.   $0000000100045FFA
  8.   $00000001000461DB
  9.   $000000010019D378
  10.   $000000010003DCE5
  11.   $0000000100017941
  12.   $0000000100001A3D
  13.   $0000000100001A56
  14.   $0000000100014280
  15.   $0000000100001850
  16.   $00007FFD4B2B257D
  17.   $00007FFD4CDEAF08

Line 17:
Code: Pascal  [Select][+][-]
  1. interface

I have attach the source file xmm.pas below the request...
Title: Re: internal Compiler Error
Post by: marcov on July 09, 2025, 02:03:29 pm
Works fine for me with both trunk and release, but I get compilation errors.

Code: Pascal  [Select][+][-]
  1. c:\testing>fpc -Px86_64 -Twin64 xmm.pas
  2. Free Pascal Compiler version 3.2.2 [2021/05/15] for x86_64
  3. Copyright (c) 1993-2021 by Florian Klaempfl and others
  4. Target OS: Win64 for x64
  5. Compiling xmm.pas
  6. xmm.pas(168,9) Error: Identifier not found "_atomic32"
  7. xmm.pas(174,3) Error: Identifier not found "_atomic32"
  8. xmm.pas(272,13) Error: Identifier not found "xgetmem"
  9. xmm.pas(275,3) Error: Identifier not found "xfillmem"
  10. xmm.pas(453,13) Error: Identifier not found "xfillmem"
  11. xmm.pas(581,3) Error: Identifier not found "xmminit"
  12. xmm.pas(584) Fatal: There were 6 errors compiling module, stopping
  13. Fatal: Compilation aborted
  14. Error: c:\fpc\3.2.2\bin\i386-win32\ppcrossx64.exe returned an error exitcode

Sounds like it is a problem with a custom RTL or so.
Title: Re: internal Compiler Error
Post by: Nitorami on July 09, 2025, 03:13:57 pm
marcov: Setting -dDLLEXPORT avoids these error messages.

When compiling with Lazarus 2.2.6 (64bit) and FPC3.2.2 under windows, I get this message

"Fatal: Kann system nicht finden verwendet von xmm. Stellen Sie sicher, daß alle .ppu-Dateien eines Packages sich in dessem Ausgabeverzeichnis befinden. ppu im falschen Verzeichnis=C:\lazarus\fpc\3.2.2\units\x86_64-win64\rtl\system.ppu.."

Does that help ?

EDIT: When copying system.ppu across as requested, the message goes away but then the complaint is about objpas.ppu...

EDIT2: When simply copying all x86-win64 ppus across to the program's output directory, the only remaining error is the undeclared identifier MEM_RESERVE.

Wwhat is specific about this code that the compiler seems to expect all ppus in the program's output directory ?
Title: Re: internal Compiler Error
Post by: Thaddy on July 09, 2025, 03:21:04 pm
Naming your file xmm is a bit like little Bobby drop tables.
Asking for trouble.
Title: Re: internal Compiler Error
Post by: paule32 on July 09, 2025, 05:25:14 pm
the Problem lay in the using of Command Line Options...

I have to use always -B (build all new) - then I compile/work
When I use without   -B (and with -Ur) - problems begin
When I use with  -Us -Ur the problems begin, too - but a little bit other than the line above ...

It is not a problem, that I share the source code.
The thinking is an artefact on fibodev, he would not public his code - but now, he give me green light to publish it.
Title: Re: internal Compiler Error
Post by: marcov on July 09, 2025, 06:38:30 pm
marcov: Setting -dDLLEXPORT avoids these error messages.

When compiling with Lazarus 2.2.6 (64bit) and FPC3.2.2 under windows, I get this message

"Fatal: Kann system nicht finden verwendet von xmm. Stellen Sie sicher, daß alle .ppu-Dateien eines Packages sich in dessem Ausgabeverzeichnis befinden. ppu im falschen Verzeichnis=C:\lazarus\fpc\3.2.2\units\x86_64-win64\rtl\system.ppu.."

I have a default FPC 32+64 install, and it works fine, but:

Code: Pascal  [Select][+][-]
  1. Free Pascal Compiler version 3.3.1 [2025/06/12] for x86_64
  2. Copyright (c) 1993-2025 by Florian Klaempfl and others
  3. Target OS: Win64 for x64
  4. Compiling xmm.pas
  5. xmm.pas(236,71) Error: Identifier not found "MEM_RESERVE"
  6. xmm.pas(584) Fatal: There were 1 errors compiling module, stopping
  7. Fatal: Compilation aborted
  8. Error: c:\pp64\bin\x86_64-win64\ppcx64.exe returned an error exitcode
  9.  

Quote
EDIT: When copying system.ppu across as requested, the message goes away but then the complaint is about objpas.ppu...

That is normal, that is the "system" unit add-on for Delphi and objfpc modes.

Quote
EDIT2: When simply copying all x86-win64 ppus across to the program's output directory, the only remaining error is the undeclared identifier MEM_RESERVE.

Wwhat is specific about this code that the compiler seems to expect all ppus in the program's output directory ?

Any compilation expects the RTL to be reachable. This is normally done by the -Fu line in fpc.cfg which is done by the installer.
Title: Re: internal Compiler Error
Post by: paule32 on July 09, 2025, 06:52:47 pm
Code: Bash  [Select][+][-]
  1. T:\a>grep MEM_RE *.pas
  2. File windows.pas:
  3.   MEM_RESERVE     = $00002000;

The current Code state: https://github.com/minifpc/miniRTL/tree/main (https://github.com/minifpc/miniRTL/tree/main)
Title: Re: internal Compiler Error
Post by: marcov on July 09, 2025, 09:25:27 pm
Code: Bash  [Select][+][-]
  1. T:\a>grep MEM_RE *.pas
  2. File windows.pas:
  3.   MEM_RESERVE     = $00002000;

Which you don't USES in unit XMM.

Title: Re: internal Compiler Error
Post by: paule32 on July 10, 2025, 01:18:13 pm
@marcov:

can you provide the Command Line inclusive the options, you compile xmm.pas ?

I would be glad when CLI contains -Us and/or -Ur

Thanksfully thanks
Title: Re: internal Compiler Error
Post by: marcov on July 10, 2025, 04:12:36 pm
Code: Pascal  [Select][+][-]
  1. fpc -Ur -dDLLEXPORT xmm
  2. Free Pascal Compiler version 3.3.1 [2025/06/12] for x86_64
  3. Copyright (c) 1993-2025 by Florian Klaempfl and others
  4. Target OS: Win64 for x64
  5. Compiling xmm.pas
  6. 585 lines compiled, 0.0 sec

Only change I  made is

Code: Pascal  [Select][+][-]
  1. uses windows;

after the interface line.

For the release 32+64 installer I need to select the 64-bit target, so addition -P and -T lines appear:

Code: Pascal  [Select][+][-]
  1. fpc -Px86_64 -Twin64 -Ur -dDLLEXPORT xmm
  2. Free Pascal Compiler version 3.2.2 [2021/05/15] for x86_64
  3. Copyright (c) 1993-2021 by Florian Klaempfl and others
  4. Target OS: Win64 for x64
  5. Compiling xmm.pas
  6. 585 lines compiled, 0.4 sec
  7.  

-Us is not necessary, that should only be used to compile a system unit.
Title: Re: internal Compiler Error
Post by: paule32 on July 10, 2025, 06:23:32 pm
you are sure that is all ?
I get the Output below:

Code: Bash  [Select][+][-]
  1. T:\a\miniFPC\TinyFPC>fpc.exe -Px86_64 -Twin64 -Ur -dDLLEXPORT xmm.pas
  2. Free Pascal Compiler version 3.2.2-r0d122c49 [2025/07/05] for x86_64
  3. Copyright (c) 1993-2021 by Florian Klaempfl and others
  4. Target OS: Win64 for x64
  5. Compiling xmm.pas
  6. Compiling windows.pas
  7. Compiling objpas.pas
  8. Compiling system.pas
  9. system.pas(20,1) Fatal: Internal error 2016060303
  10. Fatal: Compilation aborted
  11. Error: C:\FPC\3.2.2\win64\fpc\bin\x86_64-win64\ppcx64.exe returned an error exitcode

Code: Pascal  [Select][+][-]
  1. // ---------------------------------------------------------------------------------------
  2. // Copyright(c) 2025 @paule32 and @fibonacci
  3. // ---------------------------------------------------------------------------------------
  4.  
  5. unit system;
  6.  
  7. {$mode objfpc}{$H+}
  8. {$modeswitch advancedrecords}
  9. {$macro on}
  10.  
  11. // @@todo: reorder functions; interface vs implementation mismatch
  12.  
  13. // system.pas(9,1) Error: Internal error 2016060303
  14.  
  15. // IE 2006012304 means "compile system.pas first", and happens on latest trunk
  16.  
  17. {$WARN 6058 off : Call to subroutine "$1" marked as inline is not inlined}
  18.  
  19. interface  // <-- this is line 20 in system.pas
Title: Re: internal Compiler Error
Post by: marcov on July 10, 2025, 07:31:25 pm
Yes, standard FPC 32+64 install.  RTLs are by default never recompiled, so that is on you. To my knowledge the System unit must always be compiled separately with -Us.
Title: Re: internal Compiler Error
Post by: paule32 on July 10, 2025, 07:32:21 pm
okay...
after some fruggle work, it seems that I had did done.
The FPC output follows.
Is it possible to presume the Warning's and Note's that appear during the compile ?

Code: Bash  [Select][+][-]
  1. T:\a\miniFPC\TinyFPC>fpc.exe -Px86_64 -Twin64 -Us -Ur -dDLLEXPORT system.pas
  2. Free Pascal Compiler version 3.2.2-r0d122c49 [2025/07/05] for x86_64
  3. Copyright (c) 1993-2021 by Florian Klaempfl and others
  4. Target OS: Win64 for x64
  5. Compiling system.pas
  6. objects.inc(330,3) Note: Local variable "vmt" not used
  7. objects.inc(690,10) Warning: Function result does not seem to be set
  8. objects.inc(725,10) Warning: Function result does not seem to be set
  9. strings.inc(120,3) Note: Local variable "idx" is assigned but never used
  10. strings.inc(210,10) Warning: Function result does not seem to be set
  11. strings.inc(526,47) Warning: function result variable of a managed type does not seem to be initialized
  12. strings.inc(720,10) Warning: Function result does not seem to be set
  13. strings.inc(817,10) Warning: Function result does not seem to be set
  14. unicode.inc(78,10) Warning: Function result does not seem to be set
  15. unicode.inc(258,22) Warning: Arithmetic "+" on untyped pointer is unportable to {$T+}, suggest typecast
  16. ustrings.inc(130,10) Warning: Function result does not seem to be set
  17. system.pas(749,10) Warning: Function result does not seem to be set
  18. system.pas(857,4) Warning: ASM reader switch is not possible inside asm statement, "INTEL" will be effective only for next
  19. system.pas(930,3) Note: Local variable "eletype" is assigned but never used
  20. system.pas(930,12) Note: Local variable "eletypemngd" is assigned but never used
  21. exceptions64.inc(238,3) Note: Local variable "ex_rip" is assigned but never used
  22. exceptions64.inc(239,3) Note: Local variable "except_signal" is
  23. assigned but never used
  24. exceptions64.inc(240,3) Note: Local variable "reset_fpu" is assigned
  25. but never used
  26. 10542 lines compiled, 0.1 sec
  27. 11 warning(s) issued
  28. 7 note(s) issued
  29.                                                                                                                        
  30. T:\a\miniFPC\TinyFPC>fpc.exe -Px86_64 -Twin64 -Ur -dDLLEXPORT xmm.pas
  31. Free Pascal Compiler version 3.2.2-r0d122c49 [2025/07/05] for x86_64
  32. Copyright (c) 1993-2021 by Florian Klaempfl and others
  33. Target OS: Win64 for x64
  34. Compiling xmm.pas
  35. Compiling objpas.pas
  36. Compiling windows.pas
  37. 1532 lines compiled, 0.0 sec
Title: Re: internal Compiler Error
Post by: marcov on July 10, 2025, 09:36:12 pm
Showing of notes and warnings depends on -v lines in the fpc.cfg.
Title: Re: internal Compiler Error
Post by: ALLIGATOR on July 11, 2025, 10:27:44 am
FPC [git main]

Code: Pascal  [Select][+][-]
  1. C:\fpclaztrunk\fpc\bin\x86_64-win64\fpc.exe -vewnhibq -dDLLEXPORT -n -FuC:\fpclaztrunk\fpc\units\x86_64-win64\rtl xmm.pas

Code: [Select]
(1002) Target OS: Win64 for x64
(3104) Compiling xmm.pas
(1008) 585 lines compiled, 0.0 sec
Title: Re: internal Compiler Error
Post by: ALLIGATOR on July 11, 2025, 10:30:07 am
https://www.freepascal.org/docs-html/user/userap1.html

Code: [Select]
  -v<x>  Be verbose. <x> is a combination of the following letters: 
      e : Show errors (default)       0 : Show nothing (except errors) 
      w : Show warnings               u : Show unit info 
      n : Show notes                  t : Show tried/used files 
      h : Show hints                  c : Show conditionals 
      i : Show general info           d : Show debug info 
      l : Show linenumbers            r : Rhide/GCC compatibility mode 
      s : Show time stamps            q : Show message numbers 
      a : Show everything             x : Show info about invoked tools 
      b : Write file names messages   p : Write tree.log with parse tree 
          with full path              v : Write fpcdebug.txt with 
      z : Write output to stderr          lots of debugging info 
      m<x>,<y> : Do not show messages numbered <x> and <y>
TinyPortal © 2005-2018