Parcourir la source

+ seg(<procvardef>) returns the segment stored in the procedure variable

git-svn-id: trunk@38216 -
florian il y a 7 ans
Parent
commit
6400d612e8
3 fichiers modifiés avec 23 ajouts et 0 suppressions
  1. 1 0
      .gitattributes
  2. 8 0
      compiler/i8086/n8086inl.pas
  3. 14 0
      tests/tbs/tb0638.pp

+ 1 - 0
.gitattributes

@@ -11488,6 +11488,7 @@ tests/tbs/tb0634.pp svneol=native#text/pascal
 tests/tbs/tb0635.pp svneol=native#text/pascal
 tests/tbs/tb0636.pp svneol=native#text/pascal
 tests/tbs/tb0637.pp svneol=native#text/pascal
+tests/tbs/tb0638.pp svneol=native#text/pascal
 tests/tbs/tb205.pp svneol=native#text/plain
 tests/tbs/tb610.pp svneol=native#text/pascal
 tests/tbs/tb613.pp svneol=native#text/plain

+ 8 - 0
compiler/i8086/n8086inl.pas

@@ -204,6 +204,14 @@ implementation
                    location_reset(location,LOC_REGISTER,OS_16);
                    location.register:=cg.GetNextReg(left.location.register);
                  end;
+               LOC_CREFERENCE,LOC_REFERENCE:
+                  begin
+                    location_reset(location,LOC_REGISTER,OS_16);
+                    segref:=left.location.reference;
+                    inc(segref.offset,2);
+                    location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_16);
+                    current_asmdata.CurrAsmList.concat(Taicpu.op_ref_reg(A_MOV,S_W,segref,location.register));
+                  end;
                else
                  internalerror(2017121301);
              end;

+ 14 - 0
tests/tbs/tb0638.pp

@@ -0,0 +1,14 @@
+{ %cpu=i8086 }
+{$MODE TP}
+program tsegie;
+
+var
+  a: procedure;
+  b: word;
+
+begin
+  a:=nil;
+  b:=seg(a);
+  if b<>0 then
+    halt(1);
+end.