FPC internal error 200408203 when compiling Lazarus 2.2.6 on Sparc64
Summary
When trying to build Lazarus 2.2.6 on a Sparc64 machine, we get internal error 200408203. This seems to be caused by a parameter which type is an empty record.
System Information
- Operating system: Debian Linux (Bookworm, Bullseye)
- Processor architecture: Sparc64
- Compiler version: 3.2.2+dfsg-20
- Device: Spar64 station, Virtual machine
Steps to reproduce
Try to compile Lazarus or at least lazutils:
/usr/bin/make -C components/lazutils
...
/usr/bin/ppcsparc64 -MObjFPC -Scghi -O1 -g -gl -l -vewnhibq -Fu../../packager/units/sparc64-linux -Fu. -Fu/usr/lib/sparc64-linux-gnu/fpc/3.2.2/units/sparc64-linux/rtl -FE. -FUlib/sparc64-linux @/<<PKGBUILDDIR>>/debian/deb-host-fpc.cfg -dsparc64 lazutils.pas
Example Project
No sure it is possible to reproduce with smaller project. However I have done some investigation that are exposed below.
What is the current bug behavior?
Compilation log:
(9009) Assembling lazlogger
(3104) Compiling lazloggerdummy.pas
/<<PKGBUILDDIR>>/components/lazutils/LazLoggerImpl.inc(11,3) Note: (6058) Call to subroutine "function GetDebugLogger:TLazLogger;" marked as inline is not inlined
/<<PKGBUILDDIR>>/components/lazutils/LazLoggerImpl.inc(156,1) Fatal: Internal error 200408203
Fatal: (1018) Compilation aborted
What is the expected (correct) behavior?
Compilation should not stop and should produce a valid executable like on other supported targets.
Relevant logs and/or screenshots
Full logs are available on https://buildd.debian.org/status/fetch.php?pkg=lazarus&arch=sparc64&ver=2.2.6%2Bdfsg2-1&stamp=1682868740&raw=0
The investigation show that the issue happens when parameter of a function has no location. The internal error is triggered at `ncgutil.pas:720
procedure gen_load_cgpara_loc(list: TAsmList; vardef: tdef; const para: TCGPara; var destloc: tlocation; reusepara: boolean);
...
begin
paraloc:=para.location;
if not assigned(paraloc) then
internalerror(200408203); // <========== This is the line 720
{ skip e.g. empty records }
if (paraloc^.loc = LOC_VOID) then
exit;
case destloc.loc of
This error is triggered by LazLoggerImpl.inc:156
when included by lazloggerdummy.pas
The code that triggers the error is:
procedure DebuglnStack(LogEnabled: TLazLoggerLogEnabled; const s: string);
begin
{$IFnDEF USED_BY_LAZLOGGER_DUMMY}
DebugLogger.DebuglnStack(LogEnabled, s);
{$ENDIF}
end;
While TLazLoggerLogEnabled
is defined in lazloggerdummy.pas:44
as follows:
TLazLoggerLogEnabled = record end;
It seems that, and only under Sparc architecture, this parameters which type is this kind of empty records are not allocated a storage location.