Browse Source

* fix loading of enum subranges from ppu

git-svn-id: trunk@535 -
peter 20 years ago
parent
commit
627a3b53e8
4 changed files with 44 additions and 0 deletions
  1. 2 0
      .gitattributes
  2. 13 0
      compiler/symdef.pas
  3. 18 0
      tests/webtbs/tw4140.pp
  4. 11 0
      tests/webtbs/uw4140.pp

+ 2 - 0
.gitattributes

@@ -6101,6 +6101,7 @@ tests/webtbs/tw4078.pp svneol=native#text/plain
 tests/webtbs/tw4089.pp svneol=native#text/plain
 tests/webtbs/tw4093.pp svneol=native#text/plain
 tests/webtbs/tw4115.pp svneol=native#text/plain
+tests/webtbs/tw4140.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain
@@ -6136,6 +6137,7 @@ tests/webtbs/uw3356.pp svneol=native#text/plain
 tests/webtbs/uw3429.pp svneol=native#text/plain
 tests/webtbs/uw3474a.pp svneol=native#text/plain
 tests/webtbs/uw3474b.pp svneol=native#text/plain
+tests/webtbs/uw4140.pp svneol=native#text/plain
 utils/Makefile svneol=native#text/plain
 utils/Makefile.fpc svneol=native#text/plain
 utils/README -text

+ 13 - 0
compiler/symdef.pas

@@ -684,6 +684,7 @@ interface
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderef;override;
           procedure deref;override;
+          procedure derefimpl;override;
           function  gettypename:string;override;
           function  is_publishable : boolean;override;
           procedure calcsavesize;
@@ -1785,6 +1786,18 @@ implementation
       end;
 
 
+    procedure tenumdef.derefimpl;
+      begin
+        if assigned(basedef) and
+           (firstenum=nil) then
+          begin
+            firstenum:=basedef.firstenum;
+            while assigned(firstenum) and (tenumsym(firstenum).value<>minval) do
+              firstenum:=tenumsym(firstenum).nextenum;
+          end;
+      end;
+
+
     destructor tenumdef.destroy;
       begin
         inherited destroy;

+ 18 - 0
tests/webtbs/tw4140.pp

@@ -0,0 +1,18 @@
+{ %recompile }
+unit tw4140;
+
+interface
+
+implementation
+
+uses uw4140;
+
+procedure Foo;
+var Enum: TMySubEnum;
+begin
+  { Any of two lines below causes "Internal error 309993" }
+  Writeln(Ord(Low(TMySubEnum)));
+  Writeln(Ord(Low(Enum)));
+end;
+
+end.

+ 11 - 0
tests/webtbs/uw4140.pp

@@ -0,0 +1,11 @@
+unit uw4140;
+
+interface
+
+type
+  TMyEnum = (meOne, meTwo, meThree);
+  TMySubEnum = meOne .. meTwo;
+
+implementation
+
+end.