ppc386 packages compilation crash with "-n -gwl -O4" option
Original Reporter info from Mantis: Pierre @PierreMuller
-
Reporter name: Pierre Muller
Original Reporter info from Mantis: Pierre @PierreMuller
- Reporter name: Pierre Muller
Description:
These options lead to a crash in fpcolhash.pas unit
Breakpoint 2, INTERNALERROR (I=200603251) at verbose.pas:572
572 UpdateStatus;
Program not completed(gdb) bt
#0 INTERNALERROR (I=200603251) at verbose.pas:572
#1 0x080f5c01 in DWARF_REG (R=16842770) at ./x86/cpubase.pas:641
#2 0x082cbd22 in TDEBUGINFODWARF__APPENDSYM_VAR_WITH_NAME_TYPE_OFFSET (LIST=0x55ad55e0, SYM=0x56087ce0, NAME=..., DEF=0x5559e560, OFFSET=0, FLAGS=..., this=0x55965a20) at dbgdwarf.pas:2568
#3 0x082cbc7d in TDEBUGINFODWARF__APPENDSYM_VAR (LIST=0x55ad55e0, SYM=0x56087ce0, this=0x55965a20) at dbgdwarf.pas:2527
#4 0x082cc6ae in TDEBUGINFODWARF__APPENDSYM_LOCALVAR (LIST=0x55ad55e0, SYM=0x56087ce0, this=0x55965a20) at dbgdwarf.pas:2793
#5 0x0818cb73 in TDEBUGINFO__APPENDSYM (LIST=0x55ad55e0, SYM=0x56087ce0, this=0x55965a20) at dbgbase.pas:433
#6 0x0818d0a4 in TDEBUGINFO__WRITE_SYMTABLE_SYMS (LIST=0x55ad55e0, ST=0x56823cc0, this=0x55965a20) at dbgbase.pas:541
#7 0x082cb88a in TDEBUGINFODWARF__APPENDPROCDEF (LIST=0x55ad55e0, DEF=0x5683fce0, this=0x55965a20) at dbgdwarf.pas:2418
#8 0x0818d217 in TDEBUGINFO__WRITE_SYMTABLE_PROCDEFS (LIST=0x55ad55e0, ST=0x5680cb40, this=0x55965a20) at dbgbase.pas:563
#9 0x082d0598 in TDEBUGINFODWARF2__APPEND_OBJECT_STRUCT (DEF=0x5643ac50, CREATELABEL=true, OBJECTNAME=0x5684e9e0 'TFPCOLORHASHTABLE', this=0x55965a20) at dbgdwarf.pas:4000
#10 0x082d0678 in TDEBUGINFODWARF2__APPENDDEF_OBJECT (LIST=0x55ad55e0, DEF=0x5643ac50, this=0x55965a20) at dbgdwarf.pas:4024
#11 0x0818c683 in TDEBUGINFO__APPENDDEF (LIST=0x55ad55e0, DEF=0x5643ac50, this=0x55965a20) at dbgbase.pas:273
#12 0x0818cd8c in TDEBUGINFO__WRITE_SYMTABLE_DEFS (LIST=0x55ad55e0, ST=0x55ae9d20, this=0x55965a20) at dbgbase.pas:487
#13 0x082ceedf in TDEBUGINFODWARF__INSERTTYPEINFO (this=0x55965a20) at dbgdwarf.pas:3536
#14 0x082544ef in FINISH_UNIT (MODULE=0x5564e360, IMMEDIATE=true) at pmodules.pas:1342
#15 0x08253edf in PROC_UNIT () at pmodules.pas:1119
#16 0x0821f7f1 in COMPILE (FILENAME=...) at parser.pas:385
#17 0x08249040 in TPPUMODULE__LOADPPU (this=0x5564e360) at fppu.pas:2106
#18 0x082527a4 in LOADUNITS (PRESERVEST=0x0) at pmodules.pas:514
#19 0x0825386b in PROC_UNIT () at pmodules.pas:967
#20 0x0821f7f1 in COMPILE (FILENAME=...) at parser.pas:385
#21 0x080739ba in COMPILE (CMD=0x0) at compiler.pas:278
#22 0x080482c6 in main () at pp.pas:276
The problem comes from the fact that the variable 'I',
used only in lines 173-174:
for i:=0 to high(tmp^.childs) do
tmp^.childs[i]:=nil;
gets completely optimzed out,
leading to no real-register allocation for this variable,
marked as a 'register' variable.
This lead to a crash when trying to generate the dwarf
debug information for that non-existing register.
Steps to reproduce:
Use ppc386 cross-compiler onx86_64-linux system,
at fpcsrc level
make distclean
make distclean
make -C rtl OPT="-n -gwl"
make -C rtl FPC=ppc386 OPT="-n -gwl -O4"
make -C packages FPC=ppc386 OPT="-n -gwl -O4" FPCFPMAKE=ppcx64
Additional information:
The fix is probably to add some signal inside the optimization code
(which is probably already done, as no real register is affected to that
register variable), when a register variable is not used at all so that
we skip the generation of debug information in that case.
I have no idea where the optimizer generates the information
that no real register is required...
Pierre Muller
Mantis conversion info:
- Mantis ID: 34380
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 39986 (#92acd38f)
- Target version: 3.2.0