View Issue Details

IDProjectCategoryView StatusLast Update
0031102FPCRTLpublic2017-03-28 20:53
ReporterMaciej Izak Assigned ToSven Barth  
Status resolvedResolutionfixed 
Product Version3.1.1 
Fixed in Version3.1.1 
Summary0031102: Wrong value for ManagedFldCount (TypInfo.TTypeData)
DescriptionFPC has long standing critical issue. ManagedFldCount field in TypInfo (TTypeData) contains "count" for all fields (but should contains "count" for managed fields only - as name suggest). It is not feature but highly visible bug.

* The bug has critical meaning for development of RTTI.pas because is impossible to implement in rational way IsManaged function (ManagedFldCount is used for that)
* The bug has many performance issues especially for InitializeArray/FinalizeArray.
* The bug means more Delphi incompatibility RTTI.
* For scripting languages it means many troubles (for Delphi porting code)
* TManagedField entry for each (I mean here unmanaged fields) field has zero value for programmer, it has no sense.

any partial fix with pseudo backward compatibility has no sens and will bring much more noise and confusion and more complicated RTTI code without real gain.

the proper layout for part related to records (in current state) in TTypeData is:

      tkRecord: ( // could be extended for info about attributes, methods and operators (maybe also properties)
        RecSize: Integer;
        ManagedFldCount: Integer;
       {ManagedFields: array[0..ManagedFldCnt - 1] of TManagedField;
        RecFldCnt: Integer;
        RecFields: array[1..RecFldCnt] of TRecordTypeField});


  TRecordTypeField = packed record
    Field: TManagedField;
    Flags: Byte; // visibility
    Name: ShortString;

When we have additional "Name" and "Flag" for managed and unamanaged fields it has sense, because when we have more info than pure TManagedField for each field, it could be used for ORM or for scripts. Probably is good idea to correlate RecFields together with:


The patch provided in 0029767 is wrong when we thinking about extended RTTI (init table should stay simple as possible), same for MO PART 2 ( )

It must be changed same as was needed change for indirect type info (PPTypeInfo) for greater good. Thanks.
TagsNo tags attached.
Fixed in Revision35180
Attached Files


Sven Barth

2017-01-07 15:29

manager   ~0097352

I think we can close this now due to the changes done in r35180, don't you think? ;)

Issue History

Date Modified Username Field Change
2016-12-11 13:17 Maciej Izak New Issue
2017-01-07 15:29 Sven Barth Fixed in Revision => 35180
2017-01-07 15:29 Sven Barth Note Added: 0097352
2017-01-07 15:29 Sven Barth Status new => resolved
2017-01-07 15:29 Sven Barth Fixed in Version => 3.1.1
2017-01-07 15:29 Sven Barth Resolution open => fixed
2017-01-07 15:29 Sven Barth Assigned To => Sven Barth