View Issue Details

IDProjectCategoryView StatusLast Update
0034380FPCCompilerpublic2018-10-18 20:41
ReporterPierre Muller Assigned ToPierre Muller  
Status resolvedResolutionfixed 
Product Version3.3.1 
Target Version3.2.0Fixed in Version3.3.1 
Summary0034380: ppc386 packages compilation crash with "-n -gwl -O4" option
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
0000001 0x080f5c01 in DWARF_REG (R=16842770) at ./x86/cpubase.pas:641
0000002 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
0000003 0x082cbc7d in TDEBUGINFODWARF__APPENDSYM_VAR (LIST=0x55ad55e0, SYM=0x56087ce0, this=0x55965a20) at dbgdwarf.pas:2527
0000004 0x082cc6ae in TDEBUGINFODWARF__APPENDSYM_LOCALVAR (LIST=0x55ad55e0, SYM=0x56087ce0, this=0x55965a20) at dbgdwarf.pas:2793
0000005 0x0818cb73 in TDEBUGINFO__APPENDSYM (LIST=0x55ad55e0, SYM=0x56087ce0, this=0x55965a20) at dbgbase.pas:433
0000006 0x0818d0a4 in TDEBUGINFO__WRITE_SYMTABLE_SYMS (LIST=0x55ad55e0, ST=0x56823cc0, this=0x55965a20) at dbgbase.pas:541
0000007 0x082cb88a in TDEBUGINFODWARF__APPENDPROCDEF (LIST=0x55ad55e0, DEF=0x5683fce0, this=0x55965a20) at dbgdwarf.pas:2418
0000008 0x0818d217 in TDEBUGINFO__WRITE_SYMTABLE_PROCDEFS (LIST=0x55ad55e0, ST=0x5680cb40, this=0x55965a20) at dbgbase.pas:563
0000009 0x082d0598 in TDEBUGINFODWARF2__APPEND_OBJECT_STRUCT (DEF=0x5643ac50, CREATELABEL=true, OBJECTNAME=0x5684e9e0 'TFPCOLORHASHTABLE', this=0x55965a20) at dbgdwarf.pas:4000
0000010 0x082d0678 in TDEBUGINFODWARF2__APPENDDEF_OBJECT (LIST=0x55ad55e0, DEF=0x5643ac50, this=0x55965a20) at dbgdwarf.pas:4024
0000011 0x0818c683 in TDEBUGINFO__APPENDDEF (LIST=0x55ad55e0, DEF=0x5643ac50, this=0x55965a20) at dbgbase.pas:273
0000012 0x0818cd8c in TDEBUGINFO__WRITE_SYMTABLE_DEFS (LIST=0x55ad55e0, ST=0x55ae9d20, this=0x55965a20) at dbgbase.pas:487
0000013 0x082ceedf in TDEBUGINFODWARF__INSERTTYPEINFO (this=0x55965a20) at dbgdwarf.pas:3536
0000014 0x082544ef in FINISH_UNIT (MODULE=0x5564e360, IMMEDIATE=true) at pmodules.pas:1342
0000015 0x08253edf in PROC_UNIT () at pmodules.pas:1119
0000016 0x0821f7f1 in COMPILE (FILENAME=...) at parser.pas:385
0000017 0x08249040 in TPPUMODULE__LOADPPU (this=0x5564e360) at fppu.pas:2106
0000018 0x082527a4 in LOADUNITS (PRESERVEST=0x0) at pmodules.pas:514
0000019 0x0825386b in PROC_UNIT () at pmodules.pas:967
0000020 0x0821f7f1 in COMPILE (FILENAME=...) at parser.pas:385
0000021 0x080739ba in COMPILE (CMD=0x0) at compiler.pas:278
0000022 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

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
TagsNo tags attached.
Fixed in Revision39986
Attached Files


Pierre Muller

2018-10-04 05:41

developer   ~0111231

I just verified,
the same error happens on a i386-linux system also,
cross-compilation is not relevant.


Pierre Muller

2018-10-18 20:41

developer   ~0111464

I committed a fix,
which avoid the internal error,
but might generate invalid dwarf debug information.

  This needs to be tested further.

Issue History

Date Modified Username Field Change
2018-10-04 05:31 Pierre Muller New Issue
2018-10-04 05:41 Pierre Muller Note Added: 0111231
2018-10-18 20:41 Pierre Muller Fixed in Revision => 39986
2018-10-18 20:41 Pierre Muller Note Added: 0111464
2018-10-18 20:41 Pierre Muller Status new => resolved
2018-10-18 20:41 Pierre Muller Fixed in Version => 3.3.1
2018-10-18 20:41 Pierre Muller Resolution open => fixed
2018-10-18 20:41 Pierre Muller Assigned To => Pierre Muller
2018-10-18 20:41 Pierre Muller Target Version => 3.2.0