Bug 451172

Summary: ppcx64 crashes when compiling hedgewars
Product: [Fedora] Fedora Reporter: Hans de Goede <hdegoede>
Component: fpcAssignee: Joost van der Sluis <joost>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-07-08 04:34:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 449649    

Description Hans de Goede 2008-06-13 07:11:02 UTC
This is a carboncopy of a bug I reported upstream, as I guess there is little
that can be done at the Fedora level, still I wanted to register it here too for
tracking it from Fedora:

Short intro: I'm a Fedora developer/packager, as such I maintain the Fedora
packages for hedgewars:
http://www.hedgewars.org/ [^]

A free game written in pascal.

Recently I received a bugreport that hedgewars does not properly rebuild from
source using the Fedora hedgewars sources:
https://bugzilla.redhat.com/show_bug.cgi?id=449649 [^]

I've investigated this, and it turns out that on x86_64 fpc (actually ppcx64)
crashes when compiling hedgewars. Unfortunately this only happens sometimes, so
it could be caused by something like using uninitialized memory, or be memory
layout dependant (memory layout changes each run under Fedora, as we do memory
address randomalization as a security measure).

I've installed the debuginfo of fpc, and run the crashing fpc command under gdb,
with follow fork activated so it also debugged the spawn ppcx64 project this
gave me the following backtrace in gdb:

#0 0x00000000004aa646 in GET_ALIAS (GET_ALIAS=65, N=4447, self=0x500d1f0)
    at rgobj.pas:950
0000001 0x000000000055fbfb in DO_SPILL_REPLACE (DO_SPILL_REPLACE=false,
    LIST=0x7fd5116d46f0, INSTR=0x7fd5115d3cb0, ORGREG=65, SPILLTEMP=
      {OFFSET = -312, SYMBOL = 0x0, RELSYMBOL = 0x0, SEGMENT = 0, BASE =
17104902, INDEX = 0, REFADDR = ADDR_NO, SCALEFACTOR = 0, ALIGNMENT = 0},
    self=0x500d1f0) at x86/rgx86.pas:138
0000002 0x00000000004acf6d in INSTR_SPILL_REGISTER (INSTR_SPILL_REGISTER=false,
    LIST=0x7fd5116d46f0, INSTR=0x7fd5115d3cb0, R=@0x7fff196f5770,
    SPILLTEMPLIST=@0x50235f0, self=0x500d1f0) at rgobj.pas:1928
0000003 0x00000000004acacf in SPILL_REGISTERS (SPILL_REGISTERS=true,
    LIST=0x7fd5116d46f0, HEADERTAI=0x7fd5115aac70, self=0x500d1f0)
    at rgobj.pas:1768
0000004 0x00000000004a9859 in DO_REGISTER_ALLOCATION (LIST=0x7fd5116d46f0,
    HEADERTAI=0x7fd5115aac70, self=0x500d1f0) at rgobj.pas:561
0000005 0x000000000049d82d in DO_REGISTER_ALLOCATION (LIST=0x7fd5116d46f0,
    HEADERTAI=0x7fd5115aac70, self=0x170150) at cgobj.pas:764
0000006 0x0000000000523dc2 in GENERATE_CODE (self=0x11318f0) at psub.pas:960
0000007 0x0000000000524ee6 in DO_GENERATE_CODE (PI=0x11318f0,
    parentfp=0x7fff196f7c40) at psub.pas:1318
0000008 0x0000000000524e08 in READ_PROC_BODY (OLD_CURRENT_PROCINFO=0x7c14170,
    PD=0x128be30) at psub.pas:1393
0000009 0x00000000005252e5 in READ_PROC () at psub.pas:1534
0000010 0x000000000052573c in READ_DECLARATIONS (ISLIBRARY=false) at psub.pas:1622
0000011 0x0000000000521751 in BLOCK (BLOCK=0x0, ISLIBRARY=false) at psub.pas:167
0000012 0x00000000005246fa in PARSE_BODY (self=0x7c14170) at psub.pas:1203
0000013 0x000000000051fdc2 in PROC_UNIT () at pmodules.pas:1018
0000014 0x00000000004ff687 in COMPILE (FILENAME=@0x7bc290) at parser.pas:386
0000015 0x0000000000510f65 in LOADPPU (self=0x8a0430) at fppu.pas:1474
0000016 0x000000000051eaa4 in LOADUNITS () at pmodules.pas:612
0000017 0x000000000051f918 in PROC_UNIT () at pmodules.pas:915
0000018 0x00000000004ff687 in COMPILE (FILENAME=@0x7bd030) at parser.pas:386
0000019 0x0000000000510f65 in LOADPPU (self=0x8a0c30) at fppu.pas:1474
0000020 0x000000000051eaa4 in LOADUNITS () at pmodules.pas:612
0000021 0x000000000051ee16 in PARSE_IMPLEMENTATION_USES () at pmodules.pas:700
0000022 0x000000000051fc26 in PROC_UNIT () at pmodules.pas:994
0000023 0x00000000004ff687 in COMPILE (FILENAME=@0x7bccb0) at parser.pas:386
0000024 0x0000000000510f65 in LOADPPU (self=0x8a0a30) at fppu.pas:1474
0000025 0x000000000051eaa4 in LOADUNITS () at pmodules.pas:612
0000026 0x000000000051f918 in PROC_UNIT () at pmodules.pas:915
0000027 0x00000000004ff687 in COMPILE (FILENAME=@0x7bd030) at parser.pas:386
0000028 0x0000000000510f65 in LOADPPU (self=0x8a0c30) at fppu.pas:1474
0000029 0x000000000051eaa4 in LOADUNITS () at pmodules.pas:612
0000030 0x000000000051f918 in PROC_UNIT () at pmodules.pas:915
0000031 0x00000000004ff687 in COMPILE (FILENAME=@0x7bb810) at parser.pas:386
0000032 0x0000000000510f65 in LOADPPU (self=0x755c30) at fppu.pas:1474
0000033 0x000000000051eaa4 in LOADUNITS () at pmodules.pas:612
0000034 0x000000000051ee16 in PARSE_IMPLEMENTATION_USES () at pmodules.pas:700
0000035 0x000000000051fc26 in PROC_UNIT () at pmodules.pas:994
0000036 0x00000000004ff687 in COMPILE (FILENAME=@0x7bc8d0) at parser.pas:386
0000037 0x0000000000510f65 in LOADPPU (self=0x8a0830) at fppu.pas:1474
0000038 0x000000000051eaa4 in LOADUNITS () at pmodules.pas:612
0000039 0x000000000051ee16 in PARSE_IMPLEMENTATION_USES () at pmodules.pas:700
0000040 0x000000000051fc26 in PROC_UNIT () at pmodules.pas:994
0000041 0x00000000004ff687 in COMPILE (FILENAME=@0x7bb490) at parser.pas:386
0000042 0x0000000000510f65 in LOADPPU (self=0x755a30) at fppu.pas:1474
0000043 0x000000000051eaa4 in LOADUNITS () at pmodules.pas:612
0000044 0x000000000051ee16 in PARSE_IMPLEMENTATION_USES () at pmodules.pas:700
0000045 0x000000000051fc26 in PROC_UNIT () at pmodules.pas:994
0000046 0x00000000004ff687 in COMPILE (FILENAME=@0x8ba270) at parser.pas:386
0000047 0x0000000000510f65 in LOADPPU (self=0x8a2a30) at fppu.pas:1474
0000048 0x000000000051eaa4 in LOADUNITS () at pmodules.pas:612
0000049 0x000000000051f918 in PROC_UNIT () at pmodules.pas:915
0000050 0x00000000004ff687 in COMPILE (FILENAME=@0x7bb490) at parser.pas:386
0000051 0x0000000000510f65 in LOADPPU (self=0x755a30) at fppu.pas:1474
0000052 0x000000000051eaa4 in LOADUNITS () at pmodules.pas:612
#53 0x000000000051ee16 in PARSE_IMPLEMENTATION_USES () at pmodules.pas:700
#54 0x000000000051fc26 in PROC_UNIT () at pmodules.pas:994
0000055 0x00000000004ff687 in COMPILE (FILENAME=@0x8b97f0) at parser.pas:386
0000056 0x0000000000510f65 in LOADPPU (self=0x8a2430) at fppu.pas:1474
0000057 0x000000000051eaa4 in LOADUNITS () at pmodules.pas:612
0000058 0x000000000051f918 in PROC_UNIT () at pmodules.pas:915
0000059 0x00000000004ff687 in COMPILE (FILENAME=@0x7bad90) at parser.pas:386
0000060 0x0000000000510f65 in LOADPPU (self=0x755630) at fppu.pas:1474
0000061 0x000000000051eaa4 in LOADUNITS () at pmodules.pas:612
0000062 0x00000000005209dd in PROC_PROGRAM (ISLIBRARY=false) at pmodules.pas:1294
0000063 0x00000000004ff69d in COMPILE (FILENAME=@0x7fff196ff460) at parser.pas:389
0000064 0x00000000004231c5 in COMPILE (COMPILE=32767, CMD=@0x7d5d20)
    at compiler.pas:248
0000065 0x0000000000400442 in main () at pp.pas:207


The error + dump shown by fpc itself is:
Fatal: Compilation aborted
An unhandled exception occurred at $00000000004AA646 :
EAccessViolation : Access violation
  $00000000004AA646
  $00000000004ACF6D
  $00000000004ACACF
  $00000000004A9859
  $0000000000524EE6
  $00000000005252E5
  $0000000000521751
  $00000000005246FA
  $00000000004FF687
  $0000000000510F65
  $000000000051F918
  $00000000004FF687
  $0000000000510F65
  $000000000051EE16
  $00000000004FF687
  $0000000000510F65
  $000000000051F918

Comment 1 Hans de Goede 2008-06-13 07:12:27 UTC
p.s.

Upstream bug is here:
http://bugs.freepascal.org/view.php?id=11469


Comment 2 Joost van der Sluis 2008-06-18 22:03:32 UTC
I will update fpc in rawhide to version 2.2.2-rc1, so you can test if it's fixed
in this new version of fpc.

Comment 3 Hans de Goede 2008-06-29 13:39:24 UTC
Sofar no 2.2.2-rc1 in  rawhide ..., anyways I've updated hedgewars to 0.9.4 and
that version no longer causes fpc to segfault, so whatever the problem language
construction used, it is no longer used in hedgewars 0.9.4


Comment 4 Matt Domsch 2008-07-08 04:34:39 UTC
builds as of 2008-07-03, version 2.2.0-12.fc10.