generic/enumerator: Internal error 200301231

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

generic/enumerator: Internal error 200301231

Виктор Матузенко
Hi,

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

[doj@korica ~/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:

[doj@korica ~/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
[doj@korica ~/proj/trunk/core/collection]$ uname -a
FreeBSD korica 8.3-RELEASE FreeBSD 8.3-RELEASE #0: Mon Apr  9 21:47:23
UTC 2012 [hidden email]:/usr/obj/usr/src/sys/GENERIC  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 (Виктор Матузенко)

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: generic/enumerator: Internal error 200301231

Sven Barth-2
Am 13.11.2013 12:08, schrieb Victor Matuzenko:

> Hi,
>
> I have internal error when I compile the unit (see source below):
>
> [doj@korica ~/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:
>
> [doj@korica ~/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
> [doj@korica ~/proj/trunk/core/collection]$ uname -a
> FreeBSD korica 8.3-RELEASE FreeBSD 8.3-RELEASE #0: Mon Apr  9 21:47:23
> UTC 2012 [hidden email]:/usr/obj/usr/src/sys/GENERIC  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  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: generic/enumerator: Internal error 200301231

Виктор Матузенко
Thanks, it works!

I look forward to 2.8.0 version :)

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

> Am 13.11.2013 12:08, schrieb Victor Matuzenko:
>> Hi,
>>
>> I have internal error when I compile the unit (see source below):
>>
>> [doj@korica ~/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:
>>
>> [doj@korica ~/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
>> [doj@korica ~/proj/trunk/core/collection]$ uname -a
>> FreeBSD korica 8.3-RELEASE FreeBSD 8.3-RELEASE #0: Mon Apr 9 21:47:23
>> UTC 2012 [hidden email]:/usr/obj/usr/src/sys/GENERIC 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 - [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal


--
Victor Matuzenko (Виктор Матузенко)

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal