View Issue Details

IDProjectCategoryView StatusLast Update
0036446FPCCompilerpublic2019-12-16 06:52
ReporteravkAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Platformx86, x86_64OSWindows, LinuxOS Versionw7, Ubuntu18.04
Product Version3.3.1Product Build43687 
Target VersionFixed in Version 
Summary0036446: Compiler crashes on a generic record with an anonymous record field.
DescriptionThe compiler crashes on "EAccessViolation: Access violation" exception when generic record type contains an anonymous record field:

Hint: (11030) Start of reading config file .../fpc/bin/x86_64-linux/fpc.cfg
Hint: (11031) End of reading config file .../fpc/bin/x86_64-linux/fpc.cfg
An unhandled exception occurred at $00000000004DF059:
EAccessViolation: Access violation
  $00000000004DF059

Free Pascal Compiler version 3.3.1-r43687 [2019/12/15] for x86_64
Copyright (c) 1993-2019 by Florian Klaempfl and others
(1002) Target OS: Linux for x86-64
(3104) Compiling test.lpr
.../test.lpr(42,4) Error: (1026) Compilation raised exception internally
Fatal: (1018) Compilation aborted
Error: .../fpc/bin/x86_64-linux/ppcx64 returned an error exitcode

An example reproducing the error is attached.
Tagsgenerics
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files
  • test.pas (686 bytes)
    program test;
    {$mode objfpc}
    {$modeswitch advancedrecords}
    type
      generic TElement<T> = record
        DeletedAt, SwapedAt: Integer;
        Origin: record
          Value: T;
          Index: Integer;
        end;
      end;
    
      generic TNode<T> = record
      var
        Next: ^TNode;
        Previous: ^TNode;
        Data: array of specialize TElement<T>;
      end;
    
      generic TDoublyLinkedArray<T> = class
      type
        TSpecNode = specialize TNode<T>;
        PNode = ^TSpecNode;
      private
        FCurrent,
        FNext: PNode;
      public
        constructor Create;
      end;
    
    constructor TDoublyLinkedArray.Create;
    begin
      inherited;
    end;
    
    var
      List: specialize TDoublyLinkedArray<Byte>;
    
    begin
    
    end.
    
    test.pas (686 bytes)

Activities

avk

2019-12-16 06:51

reporter  

test.pas (686 bytes)
program test;
{$mode objfpc}
{$modeswitch advancedrecords}
type
  generic TElement<T> = record
    DeletedAt, SwapedAt: Integer;
    Origin: record
      Value: T;
      Index: Integer;
    end;
  end;

  generic TNode<T> = record
  var
    Next: ^TNode;
    Previous: ^TNode;
    Data: array of specialize TElement<T>;
  end;

  generic TDoublyLinkedArray<T> = class
  type
    TSpecNode = specialize TNode<T>;
    PNode = ^TSpecNode;
  private
    FCurrent,
    FNext: PNode;
  public
    constructor Create;
  end;

constructor TDoublyLinkedArray.Create;
begin
  inherited;
end;

var
  List: specialize TDoublyLinkedArray<Byte>;

begin

end.
test.pas (686 bytes)

Issue History

Date Modified Username Field Change
2019-12-16 06:51 avk New Issue
2019-12-16 06:51 avk File Added: test.pas
2019-12-16 06:52 avk Tag Attached: generics