Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-11

generic/enumerator: Internal error 200301231

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Victor Matuzenko

Hi,

I have internal error when I compile the unit (see source below):

~/proj/trunk/core/collection]$ fpc dlist.pas4
dlist.pas4(36,1) Fatal: Internal error 200301231
Fatal: Compilation aborted
Error: /usr/local/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)

fpc version and system:

~/proj/trunk/core/collection]$ fpc -h | head -2
Free Pascal Compiler version 2.6.1 [2012/11/08] for i386 Copyright (c) 1993-2012 by Florian Klaempfl and others ~/proj/trunk/core/collection]$ uname -a
FreeBSD korica 8.3-RELEASE FreeBSD 8.3-RELEASE #0: Mon Apr 9 21:47:23 UTC 2012 i386

If I comment out all enumerator code it compiles success. How should I rewrite this code to make it works?

=============================
{$MODESWITCH RESULT}
unit dlist;
interface
type
generic TList<TValue> = object
public type
   PNode = ^TNode;
   TNode = record
     Next: PNode;
     Value: TValue;
   end;
private type
   TEnumerator = object
   private
     FNode: PNode;
     function GetCurrent: TValue;
   public
     function MoveNext: Boolean;
     property Current: TValue read GetCurrent;
   end;
private
   FFirst: TNode;
   FLast: PNode;
public
   constructor Init;
   destructor Destroy;
   procedure Insert(const Value: TValue);
   function GetEnumerator: TEnumerator;
end;
implementation
function TList.TEnumerator.GetCurrent: TValue;
begin
   Result := FNode^.Value;
end;
function TList.TEnumerator.MoveNext: Boolean;
begin
   FNode := FNode^.Next;
   Result := FNode  nil;
end;
constructor TList.Init;
begin
   FFirst.Next := nil;
   FLast := @FFirst;
end;
destructor TList.Destroy;
begin
end;
procedure TList.Insert(const Value: TValue);
var
   Node: PNode;
begin
   New(Node);
   Node^.Value := Value;
   Node^.Next := nil;
   FLast^.Next := Node;
   FLast := Node;
end;
function TList.GetEnumerator: TEnumerator;
begin
   Result.FNode := FFirst;
end;
end.
=============================
Victor Matuzenko (Виктор Матузенко)

Reply by email

Sven Barth
to Victor Matuzenko
Victor Matuzenko wrote 21 lines
Hi, I have internal error when I compile the unit (see source below): ~/proj/trunk/core/collection]$ fpc dlist.pas4 dlist.pas4(36,1) Fatal: Internal error 200301231 Fatal: Compilation aborted Error: /usr/local/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled) fpc version and system: ~/proj/trunk/core/collection]$ fpc -h | head -2 Free Pascal Compiler version 2.6.1 [2012/11/08] for i386 Copyright (c) 1993-2012 by Florian Klaempfl and others ~/proj/trunk/core/collection]$ uname -a FreeBSD korica 8.3-RELEASE FreeBSD 8.3-RELEASE #0: Mon Apr 9 21:47:23 UTC 2012 i386 If I comment out all enumerator code it compiles success. How should I rewrite this code to make it works?

You can't. The 2.6 series is simply not capable of compiling such code correctly. Only the 2.7 series works here.

Regards,
Sven

Reply by email

Victor Matuzenko
to Sven Barth

Thanks, it works!

I look forward to 2.8.0 version :)

13.11.2013 16:11, Sven Barth пишет:

Show quoted text 30 lines
Am 13.11.2013 12:08, schrieb Victor Matuzenko: > Hi, > > I have internal error when I compile the unit (see source below): > > ~/proj/trunk/core/collection]$ fpc dlist.pas4 > dlist.pas4(36,1) Fatal: Internal error 200301231 > Fatal: Compilation aborted > Error: /usr/local/bin/ppc386 returned an error exitcode (normal if > you did not specify a source file to be compiled) > > fpc version and system: > > ~/proj/trunk/core/collection]$ fpc -h | head -2 > Free Pascal Compiler version 2.6.1 [2012/11/08] for i386 > Copyright (c) 1993-2012 by Florian Klaempfl and others > ~/proj/trunk/core/collection]$ uname -a > FreeBSD korica 8.3-RELEASE FreeBSD 8.3-RELEASE #0: Mon Apr 9 21:47:23 > UTC 2012 i386 > > If I comment out all enumerator code it compiles success. > How should I rewrite this code to make it works? You can't. The 2.6 series is simply not capable of compiling such code correctly. Only the 2.7 series works here. Regards, Sven _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Victor Matuzenko (Виктор Матузенко)

Reply by email