View Issue Details

IDProjectCategoryView StatusLast Update
0036372FPCCompilerpublic2019-12-11 23:39
ReporterCyraxAssigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status newResolutionopen 
PlatformLinux x86_64OSArchOS Version3.17.4-1
Product Version3.3.1Product Buildr43596 
Target VersionFixed in Version 
Summary0036372: Compiler crashes on "EAccessViolation: Access violation" exception when rebuilding Lazarus IDE with certain packages installed
DescriptionI'm running Lazarus trunk and FPC trunk under i386-linux Arch Linux LXC container.

The package to be causing problems is lclextensions, specifically in components/lclextensions/include/generic/independentfunctions.inc source file.
See Additional Information field for more info.
Additional Information
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(16,3) Warning: Expectloc is not set in firstpass: blockn
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) lasttemp set to -4
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) temp of size 4 type persistent requested, allocated at offset -4
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) lasttemp set to -8
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) temp of size 4 type persistent requested, allocated at offset -8
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) lasttemp set to -12
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) temp of size 4 type persistent requested, allocated at offset -12
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) lasttemp set to -16
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) temp of size 4 type persistent requested, allocated at offset -16
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) lasttemp set to -20
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) temp of size 4 type persistent requested, allocated at offset -20
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) lasttemp set to -24
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) temp of size 4 type persistent requested, allocated at offset -24
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) lasttemp set to -28
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) temp of size 4 type persistent requested, allocated at offset -28
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) lasttemp set to -36
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) temp of size 8 type persistent requested, allocated at offset -36
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) lasttemp set to -44
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) temp of size 8 type persistent requested, allocated at offset -44
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(8,27) Note: tgobj: (AllocTemp) lasttemp set to -52
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(8,27) Note: tgobj: (AllocTemp) temp of size 8 type persistent requested, allocated at offset -52
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(8,3) Note: tgobj: (FreeTemp) freeing of temp at pos -52 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(9,25) Note: tgobj: (AllocTemp) temp of size 8 type persistent requested, allocated at offset -52
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(9,3) Note: tgobj: (FreeTemp) freeing of temp at pos -52 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(10,15) Note: tgobj: (FreeTemp) freeing of temp at pos -4 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(10,15) Note: tgobj: (Freetemp) temp at pos -4 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(11,5) Note: tgobj: (FreeTemp) freeing of temp at pos -4 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(11,5) Note: tgobj: (Freetemp) temp at pos -4 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(11,5) Note: tgobj: (FreeTemp) freeing of temp at pos -36 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(11,5) Note: tgobj: (Freetemp) temp at pos -36 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(12,13) Note: tgobj: (FreeTemp) freeing of temp at pos -8 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(12,13) Note: tgobj: (Freetemp) temp at pos -8 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(13,5) Note: tgobj: (FreeTemp) freeing of temp at pos -8 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(13,5) Note: tgobj: (Freetemp) temp at pos -8 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(13,5) Note: tgobj: (FreeTemp) freeing of temp at pos -44 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(13,5) Note: tgobj: (Freetemp) temp at pos -44 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(14,14) Note: tgobj: (FreeTemp) freeing of temp at pos -36 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(14,14) Note: tgobj: (Freetemp) temp at pos -36 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(14,14) Note: tgobj: (FreeTemp) freeing of temp at pos -44 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(14,14) Note: tgobj: (Freetemp) temp at pos -44 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(15,14) Note: tgobj: (FreeTemp) freeing of temp at pos -36 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(15,14) Note: tgobj: (Freetemp) temp at pos -36 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(15,14) Note: tgobj: (FreeTemp) freeing of temp at pos -44 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(15,14) Note: tgobj: (Freetemp) temp at pos -44 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(16,3) Note: tgobj: (FreeTemp) freeing of temp at pos -20 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(16,3) Note: tgobj: (Freetemp) temp at pos -20 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(18,60) Note: tgobj: (FreeTemp) freeing of temp at pos -20 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(18,60) Note: tgobj: (Freetemp) temp at pos -20 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(18,39) Note: tgobj: (FreeTemp) freeing of temp at pos -24 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(18,39) Note: tgobj: (Freetemp) temp at pos -24 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(18,24) Note: tgobj: (FreeTemp) freeing of temp at pos -20 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(18,24) Note: tgobj: (Freetemp) temp at pos -20 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(19,60) Note: tgobj: (FreeTemp) freeing of temp at pos -20 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(19,60) Note: tgobj: (Freetemp) temp at pos -20 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(19,39) Note: tgobj: (FreeTemp) freeing of temp at pos -28 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(19,39) Note: tgobj: (Freetemp) temp at pos -28 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(19,24) Note: tgobj: (FreeTemp) freeing of temp at pos -20 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(19,24) Note: tgobj: (Freetemp) temp at pos -20 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(16,3) Note: tgobj: (FreeTemp) freeing of temp at pos -20 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(16,3) Note: tgobj: (Freetemp) temp at pos -20 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(21,39) Note: tgobj: (FreeTemp) freeing of temp at pos -28 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(21,39) Note: tgobj: (Freetemp) temp at pos -28 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(21,39) Note: tgobj: (FreeTemp) freeing of temp at pos -24 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(21,39) Note: tgobj: (Freetemp) temp at pos -24 has different type (persistent), not releasing
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(21,39) Note: Location (LOC_REG) not equal to expectloc (LOC_CREG): temprefn
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(21,39) Note: Location (LOC_REG) not equal to expectloc (LOC_CREG): blockn
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(21,39) Note: Location (LOC_REG) not equal to expectloc (LOC_CREG): typeconvn
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(22,1) Note: tgobj: (FreeTemp) freeing of temp at pos -20 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(22,1) Note: tgobj: (FreeTemp) freeing of temp at pos -24 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(22,1) Note: tgobj: (FreeTemp) freeing of temp at pos -28 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(22,1) Note: tgobj: (FreeTemp) freeing of temp at pos -36 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(22,1) Note: tgobj: (FreeTemp) freeing of temp at pos -44 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(22,1) Note: tgobj: (FreeTemp) freeing of temp at pos -4 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(22,1) Note: tgobj: (FreeTemp) freeing of temp at pos -8 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(22,1) Note: tgobj: (FreeTemp) freeing of temp at pos -12 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(22,1) Note: tgobj: (FreeTemp) freeing of temp at pos -2147483648 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(22,1) Note: tgobj: (FreeTemp) freeing of temp at pos -16 requested
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) lasttemp set to -56
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(7,1) Note: tgobj: (AllocTemp) temp of size 4 type noreuse requested, allocated at offset -56
/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(22,1) Note: tgobj: (FreeTemp) freeing of temp at pos -56 requested
An unhandled exception occurred at $082AB859:
EAccessViolation: Access violation
  $082AB859  TAOPTOBJ__STRIPDEADLABELS,  line 1683 of aoptobj.pas
  $082ABB46  TAOPTOBJ__OPTIMIZECONDITIONALJUMP,  line 1928 of aoptobj.pas
  $082AC09A  TAOPTOBJ__DOJUMPOPTIMIZATIONS,  line 2198 of aoptobj.pas
  $082AC5C6  TAOPTOBJ__PEEPHOLEOPTPASS1,  line 2426 of aoptobj.pas
  $0828376D  TASMOPTIMIZER__OPTIMIZE,  line 285 of aopt.pas
  $08283BAD  OPTIMIZE,  line 391 of aopt.pas
  $081CB351  TCGPROCINFO__GENERATE_CODE,  line 1965 of psub.pas
  $081C9C93  TCGPROCINFO__GENERATE_CODE_TREE,  line 1310 of psub.pas
  $081CC0F6  READ_PROC_BODY,  line 2337 of psub.pas
  $081CC6DD  READ_PROC,  line 2540 of psub.pas
  $081CD064  READ_DECLARATIONS,  line 2770 of psub.pas
  $081C6943  BLOCK,  line 368 of psub.pas
  $081CBB44  TCGPROCINFO__PARSE_BODY,  line 2163 of psub.pas
  $082D0329  PROC_UNIT,  line 1097 of pmodules.pas
  $081B1032  COMPILE,  line 391 of parser.pas
  $081A239E  TPPUMODULE__LOADPPU,  line 2187 of fppu.pas
  $082CE932  LOADUNITS,  line 518 of pmodules.pas

/mnt/shares/ohjelmointi2/lazarus/i386/trunk/1.9.0/binary/trunk/components/lclextensions/./include/gtk2/../generic/independentfunctions.inc(10,15) Error: (1026) Compilation raised exception internally
Fatal: (1018) Compilation aborted
Error: /mnt/shares/ohjelmointi2/fpc/i386/trunk/3.3.1/binary/trunk/bin/i386-linux/ppc386 returned an error exitcode
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget-
Attached Files
  • project1.zip (770 bytes)
  • StripDeadLabelsSafety.patch (528 bytes)
    Index: compiler/aoptobj.pas
    ===================================================================
    --- compiler/aoptobj.pas	(revision 43607)
    +++ compiler/aoptobj.pas	(working copy)
    @@ -1680,7 +1680,7 @@
             NextValid := hp;
     
             { Stop if hp is an instruction, for example }
    -        while (hp1 <> BlockEnd) and (hp1.typ in [ait_label,ait_align]) do
    +        while Assigned(hp1) and (hp1 <> BlockEnd) and (hp1.typ in [ait_label,ait_align]) do
               begin
                 case hp1.typ of
                   ait_label:
    
  • fix-compiler.diff (1,160 bytes)
    diff --git a/compiler/aoptbase.pas b/compiler/aoptbase.pas
    index 64fb5c3e0c..97f2bf7520 100644
    --- a/compiler/aoptbase.pas
    +++ b/compiler/aoptbase.pas
    @@ -265,6 +265,7 @@ unit aoptbase;
     
       class function TAOptBase.SkipEntryExitMarker(current: tai; out next: tai): boolean;
         begin
    +      next:=nil;
           result:=true;
           if current.typ<>ait_marker then
             exit;
    diff --git a/compiler/aoptobj.pas b/compiler/aoptobj.pas
    index 65b5f53dbf..2553a5226b 100644
    --- a/compiler/aoptobj.pas
    +++ b/compiler/aoptobj.pas
    @@ -1691,7 +1691,7 @@ Unit AoptObj;
             NextValid := hp;
     
             { Stop if hp is an instruction, for example }
    -        while (hp1 <> BlockEnd) and (hp1.typ in [ait_label,ait_align]) do
    +        while Assigned(hp1) and (hp1 <> BlockEnd) and (hp1.typ in [ait_label,ait_align]) do
               begin
                 case hp1.typ of
                   ait_label:
    @@ -2166,6 +2166,8 @@ Unit AoptObj;
             ThisLabel: TAsmLabel;
             ThisPassResult: Boolean;
           begin
    +        hp1 := NIL;
    +        hp2 := NIL;
             Result := False;
             if (p.typ <> ait_instruction) or not IsJumpToLabel(taicpu(p)) then
               Exit;
    
    fix-compiler.diff (1,160 bytes)

Activities

Cyrax

2019-11-28 00:04

reporter   ~0119530

Attached test project which demonstrates this bug.

project1.zip (770 bytes)

Cyrax

2019-11-28 00:09

reporter   ~0119531

The test project needs to be built with these commands :
-MObjFPC
-Scghi
-O1
-g
-gl
-l
-vewnhibq
-Filib/i386-linux
-Fu.
-FUlib/i386-linux
-FE.
-oproject1


The first level optimization switch needs to be active (-O1)

J. Gareth Moreton

2019-11-29 01:22

developer   ~0119542

Does this patch fix the issue? (Strictly speaking, hp1 should never become nil unless BlockEnd is also nil, so this might be indictive of a phantom bug elsewhere)

StripDeadLabelsSafety.patch (528 bytes)
Index: compiler/aoptobj.pas
===================================================================
--- compiler/aoptobj.pas	(revision 43607)
+++ compiler/aoptobj.pas	(working copy)
@@ -1680,7 +1680,7 @@
         NextValid := hp;
 
         { Stop if hp is an instruction, for example }
-        while (hp1 <> BlockEnd) and (hp1.typ in [ait_label,ait_align]) do
+        while Assigned(hp1) and (hp1 <> BlockEnd) and (hp1.typ in [ait_label,ait_align]) do
           begin
             case hp1.typ of
               ait_label:

Cyrax

2019-12-11 20:46

reporter   ~0119767

Unfortunately your patch doesn't fix it.

An unhandled exception occurred at $082ABB41:
EAccessViolation: Access violation
  $082ABB41  TAOPTOBJ__STRIPDEADLABELS,  line 1694 of aoptobj.pas
  $082ABE06  TAOPTOBJ__OPTIMIZECONDITIONALJUMP,  line 1919 of aoptobj.pas
  $082AC412  TAOPTOBJ__DOJUMPOPTIMIZATIONS,  line 2212 of aoptobj.pas
  $082AC946  TAOPTOBJ__PEEPHOLEOPTPASS1,  line 2440 of aoptobj.pas
  $08283A7D  TASMOPTIMIZER__OPTIMIZE,  line 285 of aopt.pas
  $08283EBD  OPTIMIZE,  line 391 of aopt.pas
  $081CB391  TCGPROCINFO__GENERATE_CODE,  line 1965 of psub.pas
  $082D3D0F  PROC_PROGRAM,  line 2285 of pmodules.pas
  $081B10CB  COMPILE,  line 409 of parser.pas
  $08082BF3  COMPILE,  line 278 of compiler.pas
  $0804948F  main,  line 278 of pp.pas
  $F7D33F29


I'm building FPC trunk with this command:
make clean all install OS_TARGET=linux CPU_TARGET=i386 OPT="-gw2 -godwarfsets -godwarfmethodclassprefix -gl -O- -Xs- -Si- -vbq -Sew- -XX- -CX- -dEXTDEBUG -vh- -vn- -vw- -dDEBUG_NODE_XML -Cit -gt -gv -Cg  -Fl/lib -Fl/usr/lib -Fl/usr/lib/gcc/i686-pc-linux-gnu/9.2.0 -dTEST_WIN32_SEH" FPC=fpc REVSTR=43672 IDE=1 NOWPOCYCLE=1 ALLOW_WARNINGS=1 LINKSMART=0 CREATESMART=0 INSTALL_PREFIX="/mnt/shares/ohjelmointi2/fpc/i386/trunk/3.3.1/binary/trunk"

Cyrax

2019-12-11 21:17

reporter   ~0119770

Call stack:
#0 TAOPTOBJ__STRIPDEADLABELS(0xf7b87840, 0x55555555, 0x55555555) at aoptobj.pas:1694
0000001 TAOPTOBJ__OPTIMIZECONDITIONALJUMP(0xf7b87840, 0xf7b4c330, 0xf7b87480, 0x55555555, true) at aoptobj.pas:1919
0000002 TAOPTOBJ__DOJUMPOPTIMIZATIONS(0xf7b87840, 0xf7b87480, true) at aoptobj.pas:2212
0000003 TAOPTOBJ__PEEPHOLEOPTPASS1(0xf7b87840) at aoptobj.pas:2440
0000004 TASMOPTIMIZER__OPTIMIZE(0xf7b87840) at aopt.pas:285
0000005 OPTIMIZE(0xf7b5c900) at aopt.pas:391
0000006 TCGPROCINFO__GENERATE_CODE(0xf7b42e60) at psub.pas:1965
0000007 PROC_PROGRAM(false) at pmodules.pas:2285
0000008 COMPILE('/mnt/shares/ohjelmointi/3'...) at parser.pas:409
0000009 COMPILE(0x0) at compiler.pas:278
0000010 main at pp.pas:278

Cyrax

2019-12-11 21:32

reporter   ~0119771

Attached patch that may fix this bug.

fix-compiler.diff (1,160 bytes)
diff --git a/compiler/aoptbase.pas b/compiler/aoptbase.pas
index 64fb5c3e0c..97f2bf7520 100644
--- a/compiler/aoptbase.pas
+++ b/compiler/aoptbase.pas
@@ -265,6 +265,7 @@ unit aoptbase;
 
   class function TAOptBase.SkipEntryExitMarker(current: tai; out next: tai): boolean;
     begin
+      next:=nil;
       result:=true;
       if current.typ<>ait_marker then
         exit;
diff --git a/compiler/aoptobj.pas b/compiler/aoptobj.pas
index 65b5f53dbf..2553a5226b 100644
--- a/compiler/aoptobj.pas
+++ b/compiler/aoptobj.pas
@@ -1691,7 +1691,7 @@ Unit AoptObj;
         NextValid := hp;
 
         { Stop if hp is an instruction, for example }
-        while (hp1 <> BlockEnd) and (hp1.typ in [ait_label,ait_align]) do
+        while Assigned(hp1) and (hp1 <> BlockEnd) and (hp1.typ in [ait_label,ait_align]) do
           begin
             case hp1.typ of
               ait_label:
@@ -2166,6 +2166,8 @@ Unit AoptObj;
         ThisLabel: TAsmLabel;
         ThisPassResult: Boolean;
       begin
+        hp1 := NIL;
+        hp2 := NIL;
         Result := False;
         if (p.typ <> ait_instruction) or not IsJumpToLabel(taicpu(p)) then
           Exit;
fix-compiler.diff (1,160 bytes)

J. Gareth Moreton

2019-12-11 23:39

developer   ~0119777

Is it seriously as simple as an uninitialised variable?! This I'll have to check out!

Issue History

Date Modified Username Field Change
2019-11-27 23:55 Cyrax New Issue
2019-11-28 00:04 Cyrax File Added: project1.zip
2019-11-28 00:04 Cyrax Note Added: 0119530
2019-11-28 00:09 Cyrax Note Added: 0119531
2019-11-29 01:20 J. Gareth Moreton Assigned To => J. Gareth Moreton
2019-11-29 01:20 J. Gareth Moreton Status new => assigned
2019-11-29 01:22 J. Gareth Moreton File Added: StripDeadLabelsSafety.patch
2019-11-29 01:22 J. Gareth Moreton Note Added: 0119542
2019-11-29 01:22 J. Gareth Moreton Assigned To J. Gareth Moreton =>
2019-11-29 01:22 J. Gareth Moreton Status assigned => feedback
2019-11-29 01:22 J. Gareth Moreton FPCTarget => -
2019-12-11 20:46 Cyrax Note Added: 0119767
2019-12-11 20:46 Cyrax Status feedback => new
2019-12-11 21:17 Cyrax Note Added: 0119770
2019-12-11 21:32 Cyrax File Added: fix-compiler.diff
2019-12-11 21:32 Cyrax Note Added: 0119771
2019-12-11 23:39 J. Gareth Moreton Note Added: 0119777