View Issue Details

IDProjectCategoryView StatusLast Update
0025917FPCCompilerpublic2015-01-16 18:04
ReporterMaciej Izak Assigned ToSven Barth  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.7.1 
Fixed in Version3.1.1 
Summary0025917: "Fatal: No memory left" for generic code
DescriptionHow to crash the compiler (infinity loop and Fatal error "No memory left"):

------
{$MODE DELPHI}

type
  TA<T1, T2> = class
  end;

  TB<T1, T2> = class
  private
    type
      T3 = record end;

      TC = class(TA<T1, T3>)
      public
        procedure Foo;
      end;
  end;

procedure TB<T1, T2>.TC.Foo;
var
  L: TB<T1, T2>.T3;
begin
end;

var
  x: TB<Pointer, Pointer>;
Tagsgenerics
Fixed in Revision29486
FPCOldBugId
FPCTarget
Attached Files

Relationships

related to 0027206 resolvedSven Barth [Patch] Christmas gift by FreeSparta : Generics.Collections 

Activities

Maciej Izak

2014-03-25 13:14

reporter  

plc01.lpr (374 bytes)

Sven Barth

2015-01-16 18:04

manager   ~0080448

The problem was that type parameters were inserted as public while they should be added as strict private (Delphi does so as well). In your specific example the T2 inside the TB<T1,T2>.TC.Foo method was not refering to the T2 of TB, but to the T2 of TC's parent class TA<T1, T3>. Thus always a new generic was to be specialized...

Please test and close if okay.

Regards,
Sven

Issue History

Date Modified Username Field Change
2014-03-25 13:14 Maciej Izak New Issue
2014-03-25 13:14 Maciej Izak File Added: plc01.lpr
2014-03-26 13:18 Sven Barth Tag Attached: generics
2015-01-06 13:56 Sven Barth Relationship added related to 0027206
2015-01-06 22:32 Sven Barth Assigned To => Sven Barth
2015-01-06 22:32 Sven Barth Status new => assigned
2015-01-16 18:04 Sven Barth Fixed in Revision => 29486
2015-01-16 18:04 Sven Barth Note Added: 0080448
2015-01-16 18:04 Sven Barth Status assigned => resolved
2015-01-16 18:04 Sven Barth Fixed in Version => 3.1.1
2015-01-16 18:04 Sven Barth Resolution open => fixed