[fpc-devel] FPC trunk building lazarus trunk fails with compiler AV ?

Yuriy Sydorov jura at cp-lab.com
Mon Dec 13 12:21:22 CET 2021


On 13.12.2021 4:57, Karoly Balogh via fpc-devel wrote:
>> Should be fixed now. The AVs have occurred only when targeting the AVX FPU.
> 
> Yuriy, your fix seems to break m68k, in particular m68k runs into that
> newly added IE:
> 
> ~External command
> "/daten3/jenkins/workspace/FPCTest_m68k-linux_O2/compiler/ppcross68k
> -Tlinux -FUfcl-passrc/units/m68k-linux/
> -Fu/daten3/jenkins/workspace/FPCTest_m68k-linux_O2/rtl/units/m68k-linux/
> -Fu/daten3/jenkins/workspace/FPCTest_m68k-linux_O2/packages/fcl-base/units/m68k-linux/
> -Fu/daten3/jenkins/workspace/FPCTest_m68k-linux_O2/packages/rtl-objpas/units/m68k-linux/
> -Fufcl-passrc/src -Fl -Pm68k -XPm68k-linux- -Ur -Xs -O2 -n -O- -dm68k
> -dRELEASE -CfSOFT -O2 -XX -CX -Sc -viq fcl-passrc/BuildUnit_fcl_passrc.pp"
> failed with exit code 256. Console output:
> Target OS: Linux for m68k
> Compiling fcl-passrc/BuildUnit_fcl_passrc.pp
> Compiling ./fcl-passrc/src/pastree.pp
> pastree.pp(3155,3) Fatal: Internal error 2021121201
> Fatal: Compilation aborted
> 
> I've no doubt the problem is in the m68k target, and the IE only exposed
> it, but regardless, register allocation is not one of my strenght, so
> ideas welcomed.

The new internal error catches incorrect usage of get_alias(). It is needed to always check if a register has the 
current regtype before passing the register to get_alias().
The following patch should fix m68k.

diff --git a/compiler/m68k/rgcpu.pas b/compiler/m68k/rgcpu.pas
index d3f24951c5..3b522b74d3 100644
--- a/compiler/m68k/rgcpu.pas
+++ b/compiler/m68k/rgcpu.pas
@@ -146,6 +146,7 @@        trgcpu = class(trgobj)
                  begin
                    { source can be replaced if dest is register... }
                    if ((instr.oper[1]^.typ=top_reg) and
+                      (getregtype(instr.oper[1]^.reg)=regtype) and
                        (get_alias(getsupreg(instr.oper[1]^.reg))<>orgreg) and
                       ((instr.opcode=A_MOVE) or (instr.opcode=A_ADD) or (instr.opcode=A_SUB) or
                        (instr.opcode=A_AND) or (instr.opcode=A_OR) or (instr.opcode=A_CMP))) or




More information about the fpc-devel mailing list