Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2021-12

FPC trunk building lazarus trunk fails with compiler AV ?

10 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marco van de Voort

FPC trunk building lazarus trunk fails with compiler AV ?

An old ghost seems to have resurfaced. I didn't build a development lazarus for a while (I used a stable one for work), but at least 1-2 weeks I have this problem:

(3104) Compiling postscriptcanvas.pas
(3104) Compiling printers.pas
(3104) Compiling postscriptunicode.pas
c:\repo\lazarusgit\lcl\postscriptcanvas.pas(707,3) Warning: (6060) Case statement does not handle all possible cases
c:\repo\lazarusgit\lcl\postscriptcanvas.pas(722,30) Error: (1026) Compilation raised exception internally
Fatal: (1018) Compilation aborted
An unhandled exception occurred at $00499477:
EAccessViolation: Access violation
  $00499477  GET_ALIAS,  line 1214 of rgobj.pas   $0049C655  INSTR_SPILL_REGISTER,  line 2834 of rgobj.pas   $0049BDE3  SPILL_REGISTERS,  line 2572 of rgobj.pas   $004987DF  DO_REGISTER_ALLOCATION,  line 659 of rgobj.pas   $0048935A  DO_REGISTER_ALLOCATION,  line 903 of cgobj.pas   $004E2659  GENERATE_CODE_TREE,  line 1616 of psub.pas   $004E450B  READ_PROC,  line 2840 of psub.pas
  $004E49F9  READ_DECLARATIONS,  line 3072 of psub.pas   $0043D00A  COMPILE,  line 402 of parser.pas
  $004D44AE  LOADPPU,  line 2276 of fppu.pas
  $005AF153  LOADUNITS,  line 523 of pmodules.pas   $005AFFA8  PROC_UNIT,  line 983 of pmodules.pas   $0043D00A  COMPILE,  line 402 of parser.pas
  $00418526  COMPILE,  line 288 of compiler.pas

Compiler AVs in postscript* units have happened before afaik.

Any pointers?

Reply by email

Yuriy Sydorov
to Marco van de Voort
Marco van de Voort wrote 33 lines
FPC trunk building lazarus trunk fails with compiler AV ? An old ghost seems to have resurfaced. I didn't build a development lazarus for a while (I used a stable one for work), but at least 1-2 weeks I have this problem: (3104) Compiling postscriptcanvas.pas (3104) Compiling printers.pas (3104) Compiling postscriptunicode.pas c:\repo\lazarusgit\lcl\postscriptcanvas.pas(707,3) Warning: (6060) Case statement does not handle all possible cases c:\repo\lazarusgit\lcl\postscriptcanvas.pas(722,30) Error: (1026) Compilation raised exception internally Fatal: (1018) Compilation aborted An unhandled exception occurred at $00499477: EAccessViolation: Access violation   $00499477  GET_ALIAS,  line 1214 of rgobj.pas   $0049C655  INSTR_SPILL_REGISTER,  line 2834 of rgobj.pas   $0049BDE3  SPILL_REGISTERS,  line 2572 of rgobj.pas   $004987DF  DO_REGISTER_ALLOCATION,  line 659 of rgobj.pas   $0048935A  DO_REGISTER_ALLOCATION,  line 903 of cgobj.pas   $004E2659  GENERATE_CODE_TREE,  line 1616 of psub.pas   $004E450B  READ_PROC,  line 2840 of psub.pas   $004E49F9  READ_DECLARATIONS,  line 3072 of psub.pas   $0043D00A  COMPILE,  line 402 of parser.pas   $004D44AE  LOADPPU,  line 2276 of fppu.pas   $005AF153  LOADUNITS,  line 523 of pmodules.pas   $005AFFA8  PROC_UNIT,  line 983 of pmodules.pas   $0043D00A  COMPILE,  line 402 of parser.pas   $00418526  COMPILE,  line 288 of compiler.pas Compiler AVs in postscript* units have happened before afaik. Any pointers?

I've tried to reproduce the AV while building Lazarus on i386-win32 with -O2 and -O3 options, but it works for me. What compiler options have you used to build Lazarus?

Yuriy.

Reply by email

Marco van de Voort
to Yuriy Sydorov
Yuriy Sydorov wrote 6 lines
> Any pointers? I've tried to reproduce the AV while building Lazarus on i386-win32 with -O2 and -O3 options, but it works for me. What compiler options have you used to build Lazarus?

lazbuild --pcp=c:\repo\lazarusgit\config --build-ide=

I'll send my FPC buildscript and lazarus config dir in private.

Reply by email

Florian Klämpfl
to Marco van de Voort
Marco van de Voort wrote 14 lines
On 12-12-2021 14:47, Yuriy Sydorov via fpc-devel wrote: > >> Any pointers? > > I've tried to reproduce the AV while building Lazarus on i386-win32 with -O2 and -O3 options, but it works for me. > What compiler options have you used to build Lazarus? lazbuild --pcp=c:\repo\lazarusgit\config --build-ide= I'll send my FPC buildscript and lazarus config dir in private.

What -Cp/-Cf option do you use?

Reply by email

Yuriy Sydorov
to Marco van de Voort
Marco van de Voort wrote 11 lines
On 12-12-2021 15:19, Florian Klämpfl via fpc-devel wrote: > > What -Cp/-Cf option do you use? To compile FPC: set CPUOPTS=-O2  -Opcoreavx -Cpcoreavx set CPUOPTS64=-Cfavx I didn't enter those in Lazarus I think, so that should be pretty much default.

Should be fixed now. The AVs have occurred only when targeting the AVX FPU.

Yuriy.

Reply by email

Marco van de Voort
to Yuriy Sydorov
Yuriy Sydorov wrote 17 lines
On 12.12.2021 16:24, Marco van de Voort via fpc-devel wrote: > > On 12-12-2021 15:19, Florian Klämpfl via fpc-devel wrote: >> >> What -Cp/-Cf option do you use? > > To compile FPC: > > set CPUOPTS=-O2  -Opcoreavx -Cpcoreavx > set CPUOPTS64=-Cfavx > > I didn't enter those in Lazarus I think, so that should be pretty > much default. Should be fixed now. The AVs have occurred only when targeting the AVX FPU.

Ok, got another error, but that turned out to be the result of unit baseenc changing packages somewhere in the last few weeks.

After fixing that, everything works again (without changing any of the scripts), so THANKS!

Reply by email

Karoly Balogh
to Yuriy Sydorov: Should be fixed now. The AVs have occurred only when targeting the AVX FPU. Yuriy.

Hi,

Yuriy Sydorov wrote 7 lines
> set CPUOPTS=-O2  -Opcoreavx -Cpcoreavx > set CPUOPTS64=-Cfavx > > I didn't enter those in Lazarus I think, so that should be pretty much default. 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.

Charlie

Reply by email

Yuriy Sydorov
to Karoly Balogh
Karoly Balogh wrote 23 lines
> 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

Reply by email

Karoly Balogh
to Yuriy Sydorov

Hi,

Yuriy Sydorov wrote 8 lines
> 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.

And indeed it did, so I committed it. Thanks a lot!

Charlie

Reply by email